0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00

preserve original URL encoding

fixes #115
This commit is contained in:
Will Norris 2017-10-05 17:57:41 +00:00
parent 7dbadc01d4
commit 37c9f4d6ab
2 changed files with 5 additions and 1 deletions

View file

@ -333,7 +333,7 @@ func NewRequest(r *http.Request, baseURL *url.URL) (*Request, error) {
var err error
req := &Request{Original: r}
path := r.URL.Path[1:] // strip leading slash
path := r.URL.EscapedPath()[1:] // strip leading slash
req.URL, err = parseURL(path)
if err != nil || !req.URL.IsAbs() {
// first segment should be options

View file

@ -172,6 +172,10 @@ func TestNewRequest(t *testing.T) {
"http://localhost/http:///example.com/foo",
"http://example.com/foo", emptyOptions, false,
},
{ // escaped path
"http://localhost/http://example.com/%2C",
"http://example.com/%2C", emptyOptions, false,
},
}
for _, tt := range tests {