mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
vfs: don't open the file when using a RW handle for a null Seek
Background: cmd/mount/file.go Open() function does a Seek(0, 1) to see if the file handle is seekable to set a FUSE hint. Before this change the file was downloaded before it needed to be which was inefficient (and broke beta.rclone.org because HEAD requests caused downloads!).
This commit is contained in:
@@ -401,6 +401,9 @@ func (fh *RWFileHandle) Seek(offset int64, whence int) (ret int64, err error) {
|
||||
if fh.closed {
|
||||
return 0, ECLOSED
|
||||
}
|
||||
if !fh.opened && offset == 0 && whence != 2 {
|
||||
return 0, nil
|
||||
}
|
||||
if err = fh.openPending(false); err != nil {
|
||||
return ret, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user