Ignore prefix renames when dest directory is not empty (#5798)

Also make sure to not modify the underlying errors from
layers, we should return the error as is and one object
layer should translate the errors.

Fixes #5797
This commit is contained in:
Harshavardhana
2018-04-11 17:15:42 -07:00
committed by GitHub
parent 650c6ee8fb
commit 4a874dfbc1
4 changed files with 30 additions and 15 deletions

View File

@@ -994,6 +994,7 @@ func (s *posix) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) (err e
// we still need to allow overwriting an empty directory since it represents
// an object empty directory.
_, err = os.Stat(dstFilePath)
if err == nil && !isDirEmpty(dstFilePath) {
return errFileAccessDenied
}