support if-match/if-none-match with s3 uploads (#16551)

This commit is contained in:
Harshavardhana
2023-02-06 18:58:29 -08:00
committed by GitHub
parent 422c396d73
commit 11c7ecb5cf
2 changed files with 28 additions and 2 deletions

View File

@@ -1769,7 +1769,9 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req
}
opts.IndexCB = idxCb
if !opts.MTime.IsZero() && opts.PreserveETag != "" {
if (!opts.MTime.IsZero() && 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)