mirror of
https://github.com/versity/versitygw.git
synced 2026-09-13 03:24:16 +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
@@ -88,6 +88,7 @@ func TestDeleteObjects(s *S3Conf) {
|
||||
|
||||
func TestCopyObject(s *S3Conf) {
|
||||
CopyObject_non_existing_dst_bucket(s)
|
||||
CopyObject_copy_to_itself(s)
|
||||
CopyObject_success(s)
|
||||
}
|
||||
|
||||
|
||||
@@ -1676,6 +1676,28 @@ func CopyObject_non_existing_dst_bucket(s *S3Conf) {
|
||||
})
|
||||
}
|
||||
|
||||
func CopyObject_copy_to_itself(s *S3Conf) {
|
||||
testName := "CopyObject_copy_to_itself"
|
||||
actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
|
||||
obj := "my-obj"
|
||||
err := putObjects(s3client, []string{obj}, bucket)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), shortTimeout)
|
||||
_, err = s3client.CopyObject(ctx, &s3.CopyObjectInput{
|
||||
Bucket: &bucket,
|
||||
Key: &obj,
|
||||
CopySource: getPtr(fmt.Sprintf("%v/%v", bucket, obj)),
|
||||
})
|
||||
cancel()
|
||||
if err := checkApiErr(err, s3err.GetAPIError(s3err.ErrInvalidCopyDest)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func CopyObject_success(s *S3Conf) {
|
||||
testName := "CopyObject_success"
|
||||
actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
|
||||
|
||||
Reference in New Issue
Block a user