summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/caddyhttp.go
diff options
context:
space:
mode:
authorMohammed Al Sahaf <msaa1990@gmail.com>2021-09-16 23:40:31 +0300
committerGitHub <noreply@github.com>2021-09-16 20:40:31 +0000
commit33c70f418f780f8e9524c73fbf4bbdbdbb9d7500 (patch)
tree7590c68508368624bf777e29850868f73cbbe35f /modules/caddyhttp/caddyhttp.go
parent2ebfda1ae93d356a2d3df53bf3411248886bafaf (diff)
fileserver: properly handle escaped/non-ascii paths (#4332)
* fileserver: properly handle escaped/non-ascii paths * fileserver: tests: accommodate Windows hate of colons in files names
Diffstat (limited to 'modules/caddyhttp/caddyhttp.go')
-rw-r--r--modules/caddyhttp/caddyhttp.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go
index 784b2b9..1404c79 100644
--- a/modules/caddyhttp/caddyhttp.go
+++ b/modules/caddyhttp/caddyhttp.go
@@ -20,6 +20,7 @@ import (
"io"
"net"
"net/http"
+ "net/url"
"path/filepath"
"strconv"
"strings"
@@ -227,6 +228,7 @@ func StatusCodeMatches(actual, configured int) bool {
// never be outside of root. The resulting path can be used
// with the local file system.
func SanitizedPathJoin(root, reqPath string) string {
+ reqPath, _ = url.PathUnescape(reqPath)
if root == "" {
root = "."
}