Commit e74558ea authored by Matthew Holt's avatar Matthew Holt

browse: Fix for files and dirs with ':' in name

parent 3c967180
...@@ -196,7 +196,7 @@ func directoryListing(files []os.FileInfo, r *http.Request, canGoUp bool, root s ...@@ -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) { ...@@ -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) { ...@@ -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(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment