From 9f13b544f760c0a91b221fe1b742fc7976ea8321 Mon Sep 17 00:00:00 2001 From: Ben McClelland Date: Fri, 2 May 2025 10:07:47 -0700 Subject: [PATCH] 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. --- backend/scoutfs/scoutfs.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/scoutfs/scoutfs.go b/backend/scoutfs/scoutfs.go index 60c2e84..02c270d 100644 --- a/backend/scoutfs/scoutfs.go +++ b/backend/scoutfs/scoutfs.go @@ -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, `"`) +}