mirror of
https://github.com/willnorris/imageproxy.git
synced 2024-12-16 21:56:43 -05:00
parent
7dbadc01d4
commit
37c9f4d6ab
2 changed files with 5 additions and 1 deletions
2
data.go
2
data.go
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue