mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
browse: Fix for files and dirs with ':' in name
This commit is contained in:
parent
3c96718027
commit
e74558eaea
2 changed files with 5 additions and 5 deletions
|
@ -196,7 +196,7 @@ func directoryListing(files []os.FileInfo, r *http.Request, canGoUp bool, root s
|
||||||
fileCount++
|
fileCount++
|
||||||
}
|
}
|
||||||
|
|
||||||
url := url.URL{Path: name}
|
url := url.URL{Path: "./" + name} // prepend with "./" to fix paths with ':' in the name
|
||||||
|
|
||||||
fileinfos = append(fileinfos, FileInfo{
|
fileinfos = append(fileinfos, FileInfo{
|
||||||
IsDir: f.IsDir(),
|
IsDir: f.IsDir(),
|
||||||
|
|
|
@ -147,11 +147,11 @@ func TestBrowseTemplate(t *testing.T) {
|
||||||
|
|
||||||
<h1>/photos/</h1>
|
<h1>/photos/</h1>
|
||||||
|
|
||||||
<a href="test.html">test.html</a><br>
|
<a href="./test.html">test.html</a><br>
|
||||||
|
|
||||||
<a href="test2.html">test2.html</a><br>
|
<a href="./test2.html">test2.html</a><br>
|
||||||
|
|
||||||
<a href="test3.html">test3.html</a><br>
|
<a href="./test3.html">test3.html</a><br>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -209,7 +209,7 @@ func TestBrowseJson(t *testing.T) {
|
||||||
name += "/"
|
name += "/"
|
||||||
}
|
}
|
||||||
|
|
||||||
url := url.URL{Path: name}
|
url := url.URL{Path: "./" + name}
|
||||||
|
|
||||||
fileinfos = append(fileinfos, FileInfo{
|
fileinfos = append(fileinfos, FileInfo{
|
||||||
IsDir: f.IsDir(),
|
IsDir: f.IsDir(),
|
||||||
|
|
Loading…
Reference in a new issue