From 83b83f7768389f7ae8c1336ebc1d027376138bee Mon Sep 17 00:00:00 2001 From: Sean Turner <30396892+seanturner026@users.noreply.github.com> Date: Thu, 13 Nov 2025 14:50:47 +0100 Subject: [PATCH] s3: add support for --upload-header If-Match and If-None-Match The If-Match and If-None-Match headers were being dropped rather than implemented in the Put Object request to S3. These headers make requests conditional which allow AWS S3 Bucket Policies to prevent Object overwriting. --- backend/s3/s3.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index c12a97619..c2c3392dd 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -4552,6 +4552,10 @@ func (o *Object) prepareUpload(ctx context.Context, src fs.ObjectInfo, options [ ui.req.ContentLanguage = aws.String(value) case "content-type": ui.req.ContentType = aws.String(value) + case "if-match": + ui.req.IfMatch = aws.String(value) + case "if-none-match": + ui.req.IfNoneMatch = aws.String(value) case "x-amz-tagging": ui.req.Tagging = aws.String(value) default: