mirror of
https://github.com/pgsty/minio.git
synced 2026-07-20 04:30:26 +03:00
When object whose size is greater than 5G is uploaded using presigned POST we should return error. (#3033)
fixes #2961
This commit is contained in:
committed by
Harshavardhana
parent
e51be73ac7
commit
5999a23d3e
@@ -17,6 +17,8 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -113,3 +115,24 @@ func TestIsValidObjectName(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tests limitReader
|
||||
func TestLimitReader(t *testing.T) {
|
||||
testCases := []struct {
|
||||
data string
|
||||
maxLen int64
|
||||
err error
|
||||
}{
|
||||
{"1234567890", 15, nil},
|
||||
{"1234567890", 10, nil},
|
||||
{"1234567890", 5, errDataTooLarge},
|
||||
}
|
||||
|
||||
for i, test := range testCases {
|
||||
r := strings.NewReader(test.data)
|
||||
_, err := ioutil.ReadAll(limitReader(r, test.maxLen))
|
||||
if err != test.err {
|
||||
t.Fatalf("test %d failed: expected %v, got %v", i+1, test.err, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user