Switch back to GetObjectInfo for HEAD requests (#6513)

This commit is contained in:
Aditya Manthramurthy 2018-09-21 13:48:58 -07:00 committed by Harshavardhana
parent c1798cc89a
commit 584cb61bb8

View File

@ -450,9 +450,9 @@ func (api objectAPIHandlers) HeadObjectHandler(w http.ResponseWriter, r *http.Re
bucket := vars["bucket"] bucket := vars["bucket"]
object := vars["object"] object := vars["object"]
getObjectNInfo := objectAPI.GetObjectNInfo getObjectInfo := objectAPI.GetObjectInfo
if api.CacheAPI() != nil { if api.CacheAPI() != nil {
getObjectNInfo = api.CacheAPI().GetObjectNInfo getObjectInfo = api.CacheAPI().GetObjectInfo
} }
opts := ObjectOptions{} opts := ObjectOptions{}
@ -477,11 +477,6 @@ func (api objectAPIHandlers) HeadObjectHandler(w http.ResponseWriter, r *http.Re
ConditionValues: getConditionValues(r, ""), ConditionValues: getConditionValues(r, ""),
IsOwner: false, IsOwner: false,
}) { }) {
getObjectInfo := objectAPI.GetObjectInfo
if api.CacheAPI() != nil {
getObjectInfo = api.CacheAPI().GetObjectInfo
}
_, err := getObjectInfo(ctx, bucket, object, opts) _, err := getObjectInfo(ctx, bucket, object, opts)
if toAPIErrorCode(err) == ErrNoSuchKey { if toAPIErrorCode(err) == ErrNoSuchKey {
s3Error = ErrNoSuchKey s3Error = ErrNoSuchKey
@ -492,13 +487,11 @@ func (api objectAPIHandlers) HeadObjectHandler(w http.ResponseWriter, r *http.Re
return return
} }
gr, err := getObjectNInfo(ctx, bucket, object, nil, r.Header) objInfo, err := getObjectInfo(ctx, bucket, object, opts)
if err != nil { if err != nil {
writeErrorResponseHeadersOnly(w, toAPIErrorCode(err)) writeErrorResponseHeadersOnly(w, toAPIErrorCode(err))
return return
} }
defer gr.Close()
objInfo := gr.ObjInfo
var encrypted bool var encrypted bool
if objectAPI.IsEncryptionSupported() { if objectAPI.IsEncryptionSupported() {