|
|
@ -2739,22 +2739,35 @@ func (api objectAPIHandlers) DeleteObjectHandler(w http.ResponseWriter, r *http. |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if apiErr == ErrNone { |
|
|
|
if apiErr == ErrNoSuchKey { |
|
|
|
// http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html
|
|
|
|
writeSuccessNoContent(w) |
|
|
|
objInfo, err := deleteObject(ctx, objectAPI, api.CacheAPI(), bucket, object, r, opts) |
|
|
|
return |
|
|
|
if err != nil { |
|
|
|
} |
|
|
|
switch err.(type) { |
|
|
|
|
|
|
|
case BucketNotFound: |
|
|
|
// http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html
|
|
|
|
// When bucket doesn't exist specially handle it.
|
|
|
|
objInfo, err := deleteObject(ctx, objectAPI, api.CacheAPI(), bucket, object, r, opts) |
|
|
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r)) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
switch err.(type) { |
|
|
|
} |
|
|
|
case BucketNotFound: |
|
|
|
// Ignore delete object errors while replying to client, since we are suppposed to reply only 204.
|
|
|
|
// When bucket doesn't exist specially handle it.
|
|
|
|
|
|
|
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL, guessIsBrowserReq(r)) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
setPutObjHeaders(w, objInfo, true) |
|
|
|
// Ignore delete object errors while replying to client, since we are suppposed to reply only 204.
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
setPutObjHeaders(w, objInfo, true) |
|
|
|
|
|
|
|
|
|
|
|
writeSuccessNoContent(w) |
|
|
|
writeSuccessNoContent(w) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sendEvent(eventArgs{ |
|
|
|
|
|
|
|
EventName: event.ObjectRemovedDelete, |
|
|
|
|
|
|
|
BucketName: bucket, |
|
|
|
|
|
|
|
Object: objInfo, |
|
|
|
|
|
|
|
ReqParams: extractReqParams(r), |
|
|
|
|
|
|
|
RespElements: extractRespElements(w), |
|
|
|
|
|
|
|
UserAgent: r.UserAgent(), |
|
|
|
|
|
|
|
Host: handlers.GetSourceIP(r), |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// PutObjectLegalHoldHandler - set legal hold configuration to object,
|
|
|
|
// PutObjectLegalHoldHandler - set legal hold configuration to object,
|
|
|
|