mirror of
https://github.com/pgsty/minio.git
synced 2026-07-23 22:16:15 +03:00
Fix presigned URL for access key with special characters (#6012)
Fixes #6011
This commit is contained in:
committed by
kannappanr
parent
6fb0604502
commit
eafc15cd47
@@ -120,39 +120,6 @@ func TestIsValidRegion(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Tests validate the URL path encoder.
|
||||
func TestGetURLEncodedName(t *testing.T) {
|
||||
testCases := []struct {
|
||||
// Input.
|
||||
inputStr string
|
||||
// Expected result.
|
||||
result string
|
||||
}{
|
||||
// % should be encoded as %25
|
||||
{"thisisthe%url", "thisisthe%25url"},
|
||||
// UTF-8 encoding.
|
||||
{"本語", "%E6%9C%AC%E8%AA%9E"},
|
||||
// UTF-8 encoding with ASCII.
|
||||
{"本語.1", "%E6%9C%AC%E8%AA%9E.1"},
|
||||
// Unusual ASCII characters.
|
||||
{">123", "%3E123"},
|
||||
// Fragment path characters.
|
||||
{"myurl#link", "myurl%23link"},
|
||||
// Space should be set to %20 not '+'.
|
||||
{"space in url", "space%20in%20url"},
|
||||
// '+' shouldn't be treated as space.
|
||||
{"url+path", "url%2Bpath"},
|
||||
}
|
||||
|
||||
// Tests generated values from url encoded name.
|
||||
for i, testCase := range testCases {
|
||||
result := getURLEncodedName(testCase.inputStr)
|
||||
if testCase.result != result {
|
||||
t.Errorf("Test %d: Expected URLEncoded result to be \"%s\", but found it to be \"%s\" instead", i+1, testCase.result, result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestExtractSignedHeaders - Tests validate extraction of signed headers using list of signed header keys.
|
||||
func TestExtractSignedHeaders(t *testing.T) {
|
||||
signedHeaders := []string{"host", "x-amz-content-sha256", "x-amz-date", "transfer-encoding"}
|
||||
|
||||
Reference in New Issue
Block a user