mirror of
https://github.com/versity/versitygw.git
synced 2026-09-20 06:54:47 +00:00
fix: Fixes #243, fixed the error case for CopyObject to copy the object into itself
This commit is contained in:
committed by
Ben McClelland
parent
c53707d4ae
commit
cb6b60324c
@@ -1239,6 +1239,10 @@ func (p *Posix) CopyObject(ctx context.Context, input *s3.CopyObjectInput) (*s3.
|
||||
dstBucket := *input.Bucket
|
||||
dstObject := *input.Key
|
||||
|
||||
if fmt.Sprintf("%v/%v", srcBucket, srcObject) == fmt.Sprintf("%v/%v", dstBucket, dstObject) {
|
||||
return &s3.CopyObjectOutput{}, s3err.GetAPIError(s3err.ErrInvalidCopyDest)
|
||||
}
|
||||
|
||||
_, err := os.Stat(srcBucket)
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
return nil, s3err.GetAPIError(s3err.ErrNoSuchBucket)
|
||||
|
||||
Reference in New Issue
Block a user