From 1569df222e1d7ad8f8475440f8a1b24a3cb0f7fe Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Mon, 23 Nov 2020 11:33:34 +0100 Subject: [PATCH] Fix: Directory prefix not stripped --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index d273244..c2c6f03 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,7 @@ import ( var ( cfg = struct { AssetCheckInterval time.Duration `flag:"asset-check-interval" default:"1m" description:"How often to check asset files for updates"` - AssetDir string `flag:"asset-dir" default:"." description:"Directory containing assets"` + AssetDir string `flag:"asset-dir" default:"./public" description:"Directory containing assets"` BaseURL string `flag:"base-url" default:"" description:"Base URL of this service" validate:"nonzero"` ForceSyncInterval time.Duration `flag:"force-sync-interval" default:"1m" description:"How often to force a sync without updates"` Listen string `flag:"listen" default:":3000" description:"Port/IP to listen on"` @@ -65,7 +65,7 @@ func main() { } var ( - assetServer = http.FileServer(http.Dir(cfg.AssetDir)) + assetServer = http.StripPrefix("/public", http.FileServer(http.Dir(cfg.AssetDir))) router = mux.NewRouter() ) registerAPI(router)