1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

http: improved directory listing with new template from Caddy project

This includes a new directory listing template which was originally
from the Caddy project (used with permission and copyright attribution).

This is used whenever we serve directory listings so `rclone serve
http`, `rclone serve webdav` and `rclone rcd --rc-serve`

This also modifies the tests so they work with the original template which
is easier to debug.
This commit is contained in:
calisro
2020-05-08 11:15:21 -04:00
committed by GitHub
parent 97f6f8fe19
commit c80b6d96dd
12 changed files with 457 additions and 21 deletions

View File

@@ -26,11 +26,13 @@ var (
const (
testBindAddress = "localhost:0"
testTemplate = "testdata/golden/testindex.html"
)
func startServer(t *testing.T, f fs.Fs) {
opt := httplib.DefaultOpt
opt.ListenAddr = testBindAddress
opt.Template = testTemplate
httpServer = newServer(f, &opt)
assert.NoError(t, httpServer.Serve())
testURL = httpServer.Server.URL()