mirror of
https://github.com/rclone/rclone.git
synced 2026-08-07 05:22:48 -04:00
backends: make NewObject return fs.ErrorIsDir if possible
This changes the interface to NewObject so that if NewObject is called on a directory then it should return fs.ErrorIsDir if possible without doing any extra work, otherwise fs.ErrorObjectNotFound. Tested on integration test server with: go run integration-test.go -tests backend -run TestIntegration/FsMkdir/FsPutFiles/FsNewObjectDir -branch fix-stat -maxtries 1
This commit is contained in:
1 parent
af732c5431
commit
3fbaa4c0b0
19 files changed
+42
-23
No files matched your search
@@ -1958,7 +1958,7 @@ func (o *Object) readMetaData(ctx context.Context, force bool) error {
|
||||
}
|
||||
newObj, ok := entry.(*Object)
|
||||
if !ok || dirSize >= 0 {
|
||||
return fs.ErrorNotAFile
|
||||
return fs.ErrorIsDir
|
||||
}
|
||||
if newObj.remote != o.remote {
|
||||
return fmt.Errorf("File %q path has changed to %q", o.remote, newObj.remote)
|
||||
|
||||
Reference in new issue
Block a user