summaryrefslogtreecommitdiffstats
path: root/commands/server.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-09-17 11:25:37 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-09-18 15:16:11 +0200
commit6be6752c8a0175210f0f277282e212a2cec4b4f2 (patch)
tree49318d8adea669126f9cd4a26f830209e1fd2d98 /commands/server.go
parent8e9dce1092133a44795062dbfdc917468c0c7056 (diff)
server: Fix redirects when file path contains bytes > 0x80
Fixes #10287
Diffstat (limited to 'commands/server.go')
-rw-r--r--commands/server.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/commands/server.go b/commands/server.go
index 7689f03db..06b7612fc 100644
--- a/commands/server.go
+++ b/commands/server.go
@@ -400,13 +400,14 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, net.Listener, string
}
// Ignore any query params for the operations below.
- requestURI := strings.TrimSuffix(r.RequestURI, "?"+r.URL.RawQuery)
+ requestURI, _ := url.PathUnescape(strings.TrimSuffix(r.RequestURI, "?"+r.URL.RawQuery))
for _, header := range f.c.serverConfig.MatchHeaders(requestURI) {
w.Header().Set(header.Key, header.Value)
}
if redirect := f.c.serverConfig.MatchRedirect(requestURI); !redirect.IsZero() {
+ // fullName := filepath.Join(dir, filepath.FromSlash(path.Clean("/"+name)))
doRedirect := true
// This matches Netlify's behaviour and is needed for SPA behaviour.
// See https://docs.netlify.com/routing/redirects/rewrites-proxies/