mirror of
https://github.com/pgsty/minio.git
synced 2026-07-20 20:50:22 +03:00
maxObjectSize and minObjectSize limitation added at putObjectHandler()
Put() replies back with - EntityTooLarge with > 5GB in single PUT operation - EntityTooSmall with < 1B in single PUT operation - IncompleteBody with ho Content-Length found in HTTP request header
This commit is contained in:
@@ -139,7 +139,7 @@ func (server *minioAPI) putObjectHandler(w http.ResponseWriter, req *http.Reques
|
||||
return
|
||||
}
|
||||
|
||||
// handle PublicRead ACL here
|
||||
// handle ACL's here at bucket level
|
||||
if !server.isValidOp(w, req, acceptsContentType) {
|
||||
return
|
||||
}
|
||||
@@ -155,6 +155,19 @@ func (server *minioAPI) putObjectHandler(w http.ResponseWriter, req *http.Reques
|
||||
writeErrorResponse(w, req, InvalidDigest, acceptsContentType, req.URL.Path)
|
||||
return
|
||||
}
|
||||
size := req.Header.Get("Content-Length")
|
||||
if size == "" {
|
||||
writeErrorResponse(w, req, IncompleteBody, acceptsContentType, req.URL.Path)
|
||||
return
|
||||
}
|
||||
if isMaxObjectSize(size) {
|
||||
writeErrorResponse(w, req, EntityTooLarge, acceptsContentType, req.URL.Path)
|
||||
return
|
||||
}
|
||||
if isMinObjectSize(size) {
|
||||
writeErrorResponse(w, req, EntityTooSmall, acceptsContentType, req.URL.Path)
|
||||
return
|
||||
}
|
||||
err := server.driver.CreateObject(bucket, object, "", md5, req.Body)
|
||||
switch err := iodine.ToError(err).(type) {
|
||||
case nil:
|
||||
|
||||
Reference in New Issue
Block a user