Part ID check (#1730)

* Added check in PutObjectPartHandler to make sure part ID does not exceed 10000. ErrInvalidMaxParts written to response if part ID exceeds the maximum value.
This commit is contained in:
Aakash Muttineni
2016-05-24 14:22:47 +05:30
committed by Harshavardhana
parent 584813e214
commit b48b2e7f7c
2 changed files with 13 additions and 0 deletions
+7
View File
@@ -40,6 +40,8 @@ const (
maxObjectSize = 1024 * 1024 * 1024 * 5
// minimum Part size for multipart upload is 5MB
minPartSize = 1024 * 1024 * 5
// maximum Part ID for multipart upload is 10000 (Acceptable values range from 1 to 10000 inclusive)
maxPartID = 10000
)
// isMaxObjectSize - verify if max object size
@@ -52,6 +54,11 @@ func isMinAllowedPartSize(size int64) bool {
return size >= minPartSize
}
// isMaxPartNumber - Check if part ID is greater than the maximum allowed ID.
func isMaxPartID(partID int) bool {
return partID > maxPartID
}
func contains(stringList []string, element string) bool {
for _, e := range stringList {
if e == element {