mirror of
https://github.com/minio/minio.git
synced 2025-02-24 03:49:12 -05:00
Fix ListObjectParts to list properly all parts - closes #4322
This commit is contained in:
parent
52122c0309
commit
9c50a9f567
@ -649,7 +649,7 @@ func fromGCSMultipartKey(s string) (key, uploadID string, partID int, err error)
|
||||
|
||||
key = unescape(parts[1])
|
||||
|
||||
uploadID = parts[3]
|
||||
uploadID = parts[2]
|
||||
|
||||
partID, err = strconv.Atoi(parts[3])
|
||||
if err != nil {
|
||||
@ -728,7 +728,7 @@ func (l *gcsGateway) ListObjectParts(bucket string, key string, uploadID string,
|
||||
|
||||
isTruncated := false
|
||||
|
||||
it.PageInfo().Token = toGCSMultipartKey(key, uploadID, partNumberMarker)
|
||||
it.PageInfo().Token = toGCSPageToken(toGCSMultipartKey(key, uploadID, partNumberMarker))
|
||||
it.PageInfo().MaxSize = maxParts
|
||||
|
||||
nextPartnumberMarker := 0
|
||||
|
@ -18,6 +18,41 @@ package cmd
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestEscape(t *testing.T) {
|
||||
testCases := []struct {
|
||||
Value string
|
||||
EscapedValue string
|
||||
}{
|
||||
{
|
||||
Value: "test-test",
|
||||
EscapedValue: "test%2Dtest",
|
||||
},
|
||||
{
|
||||
Value: "test/test",
|
||||
EscapedValue: "test%2Ftest",
|
||||
},
|
||||
{
|
||||
Value: "test%test",
|
||||
EscapedValue: "test%25test",
|
||||
},
|
||||
{
|
||||
Value: "%%%////+++",
|
||||
EscapedValue: "%25%25%25%2F%2F%2F%2F+++",
|
||||
},
|
||||
}
|
||||
|
||||
for i, testCase := range testCases {
|
||||
if escape(testCase.Value) != testCase.EscapedValue {
|
||||
t.Errorf("Test %d: Expected %s, got %s", i+1, testCase.EscapedValue, escape(testCase.Value))
|
||||
}
|
||||
|
||||
if unescape(testCase.EscapedValue) != testCase.Value {
|
||||
t.Errorf("Test %d: Expected %s, got %s", i+1, testCase.Value, unescape(testCase.EscapedValue))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestToGCSPageToken(t *testing.T) {
|
||||
testCases := []struct {
|
||||
Name string
|
||||
|
Loading…
x
Reference in New Issue
Block a user