Merge pull request #284 from versity/fix/dir-obj-overwrite

fix: Fixed error case when overwriting a directory object with file one
This commit is contained in:
Ben McClelland
2023-10-11 08:16:30 -07:00
committed by GitHub

View File

@@ -989,6 +989,11 @@ func (p *Posix) PutObject(ctx context.Context, po *s3.PutObjectInput) (string, e
}
// object is file
d, err := os.Stat(name)
if err == nil && d.IsDir() {
return "", s3err.GetAPIError(s3err.ErrExistingObjectIsDirectory)
}
f, err := openTmpFile(filepath.Join(*po.Bucket, metaTmpDir),
*po.Bucket, *po.Key, po.ContentLength)
if err != nil {