diff --git a/backend/local/local.go b/backend/local/local.go index 487397353..ffcfe68d6 100644 --- a/backend/local/local.go +++ b/backend/local/local.go @@ -223,9 +223,11 @@ func (b *Local) GetReader(t backend.Type, name string, offset, length uint) (io. b.open[filename(b.p, t, name)] = append(open, f) b.mu.Unlock() - _, err = f.Seek(int64(offset), 0) - if err != nil { - return nil, err + if offset > 0 { + _, err = f.Seek(int64(offset), 0) + if err != nil { + return nil, err + } } if length == 0 { diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go index 13bd54340..c904bf4bc 100644 --- a/backend/sftp/sftp.go +++ b/backend/sftp/sftp.go @@ -336,9 +336,11 @@ func (r *SFTP) GetReader(t backend.Type, name string, offset, length uint) (io.R return nil, err } - _, err = f.Seek(int64(offset), 0) - if err != nil { - return nil, err + if offset > 0 { + _, err = f.Seek(int64(offset), 0) + if err != nil { + return nil, err + } } if length == 0 {