1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-01-23 11:14:48 +02:00

Fix signing path with escaped source url

This commit is contained in:
DarthSim 2019-02-27 22:06:22 +06:00
parent ae2dfadd4a
commit 3f938c59d5

View File

@ -257,12 +257,6 @@ func decodePlainURL(parts []string) (string, string, error) {
format = urlParts[1]
}
fullURL := fmt.Sprintf("%s%s", conf.BaseURL, urlParts[0])
if _, err := url.ParseRequestURI(fullURL); err == nil {
return fullURL, format, nil
}
if unescaped, err := url.PathUnescape(urlParts[0]); err == nil {
fullURL := fmt.Sprintf("%s%s", conf.BaseURL, unescaped)
if _, err := url.ParseRequestURI(fullURL); err == nil {
@ -855,7 +849,10 @@ func parsePathBasic(parts []string, headers *processingHeaders) (string, *proces
}
func parsePath(ctx context.Context, r *http.Request) (context.Context, error) {
path := r.URL.Path
path := r.URL.RawPath
if len(path) == 0 {
path = r.URL.Path
}
parts := strings.Split(strings.TrimPrefix(path, "/"), "/")
if len(parts) < 3 {