From 31094412581c4fec05953ce2f1c287dfcc367ce8 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Fri, 4 Jun 2021 01:25:31 +0100 Subject: [PATCH] s3: Return correct error XML tag in case of copy object (#12427) In Copy Object S3 API, the server does not return correct bucket & object names when the source bucket/object does not exist, this commit fixes it. --- cmd/object-handlers.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/object-handlers.go b/cmd/object-handlers.go index fee5903b8..77ecb3cd0 100644 --- a/cmd/object-handlers.go +++ b/cmd/object-handlers.go @@ -1035,6 +1035,10 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re w.Header()[xhttp.AmzDeleteMarker] = []string{strconv.FormatBool(gr.ObjInfo.DeleteMarker)} } } + // Update context bucket & object names for correct S3 XML error response + reqInfo := logger.GetReqInfo(ctx) + reqInfo.BucketName = srcBucket + reqInfo.ObjectName = srcObject writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r)) return }