From 981a34e9d51a4bf06fea2776c86c1c4ac303beda Mon Sep 17 00:00:00 2001 From: niksis02 Date: Tue, 30 Dec 2025 12:35:14 +0400 Subject: [PATCH] fix: fixes x-amz-if-match-size parsing The `x-amz-if-match-size` parsing debug log used to appear for all `DeleteObject` calls when the header was missing. An empty-string check was missing, which led to attempting to parse an empty string into an `int64`, causing a failure and triggering the debug log. This check has now been added, and the debug log is emitted only when the header is present and contains an invalid `int64` value. --- s3api/utils/precondition.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/s3api/utils/precondition.go b/s3api/utils/precondition.go index 9f3e17f..11abb43 100644 --- a/s3api/utils/precondition.go +++ b/s3api/utils/precondition.go @@ -128,6 +128,9 @@ func ParsePreconditionDateHeader(date string) *time.Time { // if parsing fails, returns nil func ParseIfMatchSize(ctx *fiber.Ctx) *int64 { ifMatchSizeHdr := ctx.Get("x-amz-if-match-size") + if ifMatchSizeHdr == "" { + return nil + } ifMatchSize, err := strconv.ParseInt(ifMatchSizeHdr, 10, 64) if err != nil { debuglogger.Logf("failed to parse 'x-amz-if-match-size': %s", ifMatchSizeHdr)