fix routing issue for esoteric characters in gorilla/mux (#8967)
First step is to ensure that Path component is not decoded by gorilla/mux to avoid routing issues while handling certain characters while uploading through PutObject() Delay the decoding and use PathUnescape() to escape the `object` path component. Thanks to @buengese and @ncw for neat test cases for us to test with. Fixes #8950 Fixes #8647
This commit is contained in:
@@ -105,13 +105,24 @@ func TestIsValidObjectName(t *testing.T) {
|
||||
{"f*le", true},
|
||||
{"contains-^-carret", true},
|
||||
{"contains-|-pipe", true},
|
||||
{"contains-\"-quote", true},
|
||||
{"contains-`-tick", true},
|
||||
{"..test", true},
|
||||
{".. test", true},
|
||||
{". test", true},
|
||||
{".test", true},
|
||||
{"There are far too many object names, and far too few bucket names!", true},
|
||||
{"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~/!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~)", true},
|
||||
{"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", true},
|
||||
{"␀␁␂␃␄␅␆␇␈␉␊␋␌␍␎␏␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟␡", true},
|
||||
{"trailing VT␋/trailing VT␋", true},
|
||||
{"␋leading VT/␋leading VT", true},
|
||||
{"~leading tilde", true},
|
||||
{"\rleading CR", true},
|
||||
{"\nleading LF", true},
|
||||
{"\tleading HT", true},
|
||||
{"trailing CR\r", true},
|
||||
{"trailing LF\n", true},
|
||||
{"trailing HT\t", true},
|
||||
// cases for which test should fail.
|
||||
// passing invalid object names.
|
||||
{"", false},
|
||||
@@ -122,7 +133,6 @@ func TestIsValidObjectName(t *testing.T) {
|
||||
{" ../etc", false},
|
||||
{"./././", false},
|
||||
{"./etc", false},
|
||||
{`contains-\-backslash`, false},
|
||||
{`contains//double/forwardslash`, false},
|
||||
{`//contains/double-forwardslash-prefix`, false},
|
||||
{string([]byte{0xff, 0xfe, 0xfd}), false},
|
||||
|
||||
Reference in New Issue
Block a user