Mohammed Al Sahaf
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
3 additions and
5 deletions
-
modules/caddyhttp/caddyhttp.go
-
modules/caddyhttp/fileserver/browsetplcontext.go
|
|
@ -20,7 +20,6 @@ import ( |
|
|
|
"io" |
|
|
|
"net" |
|
|
|
"net/http" |
|
|
|
"net/url" |
|
|
|
"path/filepath" |
|
|
|
"strconv" |
|
|
|
"strings" |
|
|
@ -228,7 +227,6 @@ 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 = "." |
|
|
|
} |
|
|
|
|
|
@ -43,11 +43,9 @@ func (fsrv *FileServer) directoryListing(files []os.FileInfo, canGoUp bool, root |
|
|
|
|
|
|
|
isDir := f.IsDir() || isSymlinkTargetDir(f, root, urlPath) |
|
|
|
|
|
|
|
u := url.URL{Path: url.PathEscape(name)} |
|
|
|
|
|
|
|
// add the slash after the escape of path to avoid escaping the slash as well
|
|
|
|
if isDir { |
|
|
|
u.Path += "/" |
|
|
|
name += "/" |
|
|
|
dirCount++ |
|
|
|
} else { |
|
|
|
fileCount++ |
|
|
@ -67,6 +65,8 @@ func (fsrv *FileServer) directoryListing(files []os.FileInfo, canGoUp bool, root |
|
|
|
// was already set above.
|
|
|
|
} |
|
|
|
|
|
|
|
u := url.URL{Path: "./" + name} // prepend with "./" to fix paths with ':' in the name
|
|
|
|
|
|
|
|
fileInfos = append(fileInfos, fileInfo{ |
|
|
|
IsDir: isDir, |
|
|
|
IsSymlink: fileIsSymlink, |
|
|
|