Skip to content

Commit

Permalink
fix: copy object missing prefix on metadata delete
Browse files Browse the repository at this point in the history
When using the REPLACE directive, we were incorrectly removing the
old metadata on the object due to missing the metadata prefix on
the key.  Fix this to remove the correct metadata before setting
new metadata.

Fixes #787
  • Loading branch information
benmcclelland committed Sep 7, 2024
1 parent 66a7879 commit 769d04d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/posix/posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -2038,8 +2038,9 @@ func (p *Posix) CopyObject(ctx context.Context, input *s3.CopyObjectInput) (*s3.
return &s3.CopyObjectOutput{}, s3err.GetAPIError(s3err.ErrInvalidCopyDest)
}

for key := range mdmap {
err := p.meta.DeleteAttribute(dstBucket, dstObject, key)
for k := range mdmap {
err := p.meta.DeleteAttribute(dstBucket, dstObject,
fmt.Sprintf("%v.%v", metaHdr, k))
if err != nil && !errors.Is(err, meta.ErrNoSuchKey) {
return nil, fmt.Errorf("delete user metadata: %w", err)
}
Expand Down

0 comments on commit 769d04d

Please sign in to comment.