From 57f75b1d9b2a8f9a0219fe21edbdadfc557fa95a Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Mon, 10 Oct 2016 00:21:42 +0100 Subject: [PATCH] Ignore copy conditions when ETag is not available (#2888) --- cmd/object-handlers-common.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/object-handlers-common.go b/cmd/object-handlers-common.go index ee765e9cb..b79dd5783 100644 --- a/cmd/object-handlers-common.go +++ b/cmd/object-handlers-common.go @@ -80,7 +80,7 @@ func checkCopyObjectPreconditions(w http.ResponseWriter, r *http.Request, objInf // same as the one specified; otherwise return a 412 (precondition failed). ifMatchETagHeader := r.Header.Get("x-amz-copy-source-if-match") if ifMatchETagHeader != "" { - if !isETagEqual(objInfo.MD5Sum, ifMatchETagHeader) { + if objInfo.MD5Sum != "" && !isETagEqual(objInfo.MD5Sum, ifMatchETagHeader) { // If the object ETag does not match with the specified ETag. writeHeaders() writeErrorResponse(w, r, ErrPreconditionFailed, r.URL.Path) @@ -92,7 +92,7 @@ func checkCopyObjectPreconditions(w http.ResponseWriter, r *http.Request, objInf // one specified otherwise, return a 304 (not modified). ifNoneMatchETagHeader := r.Header.Get("x-amz-copy-source-if-none-match") if ifNoneMatchETagHeader != "" { - if isETagEqual(objInfo.MD5Sum, ifNoneMatchETagHeader) { + if objInfo.MD5Sum != "" && isETagEqual(objInfo.MD5Sum, ifNoneMatchETagHeader) { // If the object ETag matches with the specified ETag. writeHeaders() writeErrorResponse(w, r, ErrPreconditionFailed, r.URL.Path)