diff --git a/cmd/object-handlers-common.go b/cmd/object-handlers-common.go index 861518dae..3f3fae7a0 100644 --- a/cmd/object-handlers-common.go +++ b/cmd/object-handlers-common.go @@ -192,8 +192,7 @@ func checkPreconditionsPUT(ctx context.Context, w http.ResponseWriter, r *http.R etagMatch := opts.PreserveETag != "" && isETagEqual(objInfo.ETag, opts.PreserveETag) vidMatch := opts.VersionID != "" && opts.VersionID == objInfo.VersionID - mtimeMatch := !opts.MTime.IsZero() && objInfo.ModTime.Unix() >= opts.MTime.Unix() - if etagMatch && vidMatch && mtimeMatch { + if etagMatch && vidMatch { writeHeaders() writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrPreconditionFailed), r.URL) return true diff --git a/cmd/object-handlers.go b/cmd/object-handlers.go index 9fd943b4f..28554f758 100644 --- a/cmd/object-handlers.go +++ b/cmd/object-handlers.go @@ -1780,7 +1780,7 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req } opts.IndexCB = idxCb - if (!opts.MTime.IsZero() && opts.PreserveETag != "") || + if opts.PreserveETag != "" || r.Header.Get(xhttp.IfMatch) != "" || r.Header.Get(xhttp.IfNoneMatch) != "" { opts.CheckPrecondFn = func(oi ObjectInfo) bool { diff --git a/cmd/object-multipart-handlers.go b/cmd/object-multipart-handlers.go index da540ce53..d714d5a1e 100644 --- a/cmd/object-multipart-handlers.go +++ b/cmd/object-multipart-handlers.go @@ -192,7 +192,9 @@ func (api objectAPIHandlers) NewMultipartUploadHandler(w http.ResponseWriter, r return } - if !opts.MTime.IsZero() && opts.PreserveETag != "" { + if opts.PreserveETag != "" || + r.Header.Get(xhttp.IfMatch) != "" || + r.Header.Get(xhttp.IfNoneMatch) != "" { opts.CheckPrecondFn = func(oi ObjectInfo) bool { if _, err := DecryptObjectInfo(&oi, r); err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)