Make PutObject a nop for an object which ends with "/" and size is '0' (#3603)

This helps majority of S3 compatible applications while not returning
an error upon directory create request.

Fixes #2965
This commit is contained in:
Harshavardhana
2017-01-20 16:33:01 -08:00
committed by GitHub
parent c3f7d1026f
commit 51fa4f7fe3
7 changed files with 100 additions and 21 deletions
+5 -7
View File
@@ -115,13 +115,11 @@ func (api objectAPIHandlers) PutBucketNotificationHandler(w http.ResponseWriter,
return
}
// If Content-Length is unknown or zero, deny the request. PutBucketNotification
// always needs a Content-Length if incoming request is not chunked.
if !contains(r.TransferEncoding, "chunked") {
if r.ContentLength == -1 {
writeErrorResponse(w, ErrMissingContentLength, r.URL)
return
}
// If Content-Length is unknown or zero, deny the request.
// PutBucketNotification always needs a Content-Length.
if r.ContentLength == -1 || r.ContentLength == 0 {
writeErrorResponse(w, ErrMissingContentLength, r.URL)
return
}
// Reads the incoming notification configuration.