Merge pull request #613 from harshavardhana/pr_out_relax_minium_object_size_limit_one_can_really_upload_a_0byte_file

master
Harshavardhana 10 years ago
commit 2d5e1d3797
  1. 26
      pkg/api/api_object_handlers.go

@ -168,10 +168,19 @@ func (server *minioAPI) putObjectHandler(w http.ResponseWriter, req *http.Reques
return return
} }
/// minimum Upload size for objects in a single operation /// minimum Upload size for objects in a single operation
if isMinObjectSize(size) { //
writeErrorResponse(w, req, EntityTooSmall, acceptsContentType, req.URL.Path) // Surprisingly while Amazon in their document states that S3 objects have 1byte
return // as the minimum limit, they do not seem to enforce it one can successfully
} // create a 0byte file using a regular putObject() operation
//
// For example take a look at :-
//
// $ mc ls https://s3.amazonaws.com/ferenginar/test.go
//
// if isMinObjectSize(size) {
// writeErrorResponse(w, req, EntityTooSmall, acceptsContentType, req.URL.Path)
// return
// }
sizeInt64, err := strconv.ParseInt(size, 10, 64) sizeInt64, err := strconv.ParseInt(size, 10, 64)
if err != nil { if err != nil {
writeErrorResponse(w, req, InvalidRequest, acceptsContentType, req.URL.Path) writeErrorResponse(w, req, InvalidRequest, acceptsContentType, req.URL.Path)
@ -275,15 +284,6 @@ func (server *minioAPI) putObjectPartHandler(w http.ResponseWriter, req *http.Re
return return
} }
// last part can be less than < 5MB so we need to figure out a way to handle it first
// and then enable below code (y4m4)
//
/// minimum Upload size for multipart objects in a single operation
// if isMinMultipartObjectSize(size) {
// writeErrorResponse(w, req, EntityTooSmall, acceptsContentType, req.URL.Path)
// return
// }
sizeInt64, err := strconv.ParseInt(size, 10, 64) sizeInt64, err := strconv.ParseInt(size, 10, 64)
if err != nil { if err != nil {
writeErrorResponse(w, req, InvalidRequest, acceptsContentType, req.URL.Path) writeErrorResponse(w, req, InvalidRequest, acceptsContentType, req.URL.Path)

Loading…
Cancel
Save