fix: scoutfs etag check for multipart uploads

The Etag can be quoted or not, so the check to verify the part
Etag must remove the quotes before checking for equality. This
check is the same now as posix.
This commit is contained in:
Ben McClelland
2025-05-02 10:07:47 -07:00
parent 1f96af5c66
commit 9f13b544f7

View File

@@ -287,7 +287,7 @@ func (s *ScoutFS) CompleteMultipartUpload(ctx context.Context, input *s3.Complet
if err != nil {
etag = ""
}
if parts[i].ETag == nil || etag != *parts[i].ETag {
if parts[i].ETag == nil || !areEtagsSame(etag, *parts[i].ETag) {
return res, "", s3err.GetAPIError(s3err.ErrInvalidPart)
}
@@ -1025,3 +1025,7 @@ func isNoAttr(err error) bool {
}
return false
}
func areEtagsSame(e1, e2 string) bool {
return strings.Trim(e1, `"`) == strings.Trim(e2, `"`)
}