From a9cf32811c1abad309ab3b0b3d5893aca9336399 Mon Sep 17 00:00:00 2001 From: Poorna Date: Sun, 11 Feb 2024 18:18:43 -0800 Subject: [PATCH] Fix panic in tagging request proxying (#19032) --- cmd/bucket-replication.go | 6 ++++-- cmd/object-handlers.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/bucket-replication.go b/cmd/bucket-replication.go index fe987a202..35421dd2d 100644 --- a/cmd/bucket-replication.go +++ b/cmd/bucket-replication.go @@ -2409,8 +2409,7 @@ func proxyTaggingToRepTarget(ctx context.Context, bucket, object string, tags *t taggedCount++ continue } - errCode := minio.ToErrorResponse(err).Code - if errCode != "NoSuchKey" && errCode != "NoSuchVersion" { + if err != nil { terr = err } } @@ -2470,6 +2469,9 @@ func proxyGetTaggingToRepTarget(ctx context.Context, bucket, object string, opts tgs, _ = tags.MapToObjectTags(tagSlc[idx]) } } + if len(errs) == 1 { + proxy.Err = errs[0] + } return tgs, proxy } diff --git a/cmd/object-handlers.go b/cmd/object-handlers.go index 0303a94ab..5c9d958f2 100644 --- a/cmd/object-handlers.go +++ b/cmd/object-handlers.go @@ -3317,7 +3317,7 @@ func (api objectAPIHandlers) GetObjectTaggingHandler(w http.ResponseWriter, r *h globalReplicationStats.incProxy(bucket, getObjectTaggingAPI, false) // proxy to replication target if site replication is in place. tags, gerr := proxyGetTaggingToRepTarget(ctx, bucket, object, opts, proxytgts) - if gerr.Err != nil { + if gerr.Err != nil || tags == nil { globalReplicationStats.incProxy(bucket, getObjectTaggingAPI, true) writeErrorResponse(ctx, w, toAPIError(ctx, gerr.Err), r.URL) return