From c4c157e2f8e430192d3ffbc1c1f8f5f91476de42 Mon Sep 17 00:00:00 2001 From: mountain Date: Thu, 25 May 2023 11:22:30 +0900 Subject: [PATCH] =?UTF-8?q?fileserver=20stripprefix=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/http_handler.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/server/http_handler.go b/server/http_handler.go index 5cbdfff..5e18f7d 100644 --- a/server/http_handler.go +++ b/server/http_handler.go @@ -46,15 +46,11 @@ func (h *houstonHandler) RegisterHandlers(serveMux *http.ServeMux, prefix string logger.Println("houstonHandler registed") serveMux.Handle("/"+path.Join(prefix, "houston"), h) - dfsx := http.FileServer(http.Dir("./deploys")) - serveMux.Handle( - "/"+path.Join(prefix, "deploys", "/"), - http.StripPrefix(fmt.Sprintf("/%s/deploys", prefix), dfsx)) + fsx := http.FileServer(http.Dir("./deploys")) + serveMux.Handle(fmt.Sprintf("/%s/deploys/", prefix), http.StripPrefix(fmt.Sprintf("/%s/deploys/", prefix), fsx)) ufsx := http.FileServer(http.Dir("./downloads")) - serveMux.Handle( - "/"+path.Join(prefix, "downloads", "/"), - http.StripPrefix(fmt.Sprintf("/%s/downloads", prefix), ufsx)) + serveMux.Handle(fmt.Sprintf("/%s/downloads/", prefix), http.StripPrefix(fmt.Sprintf("/%s/downloads/", prefix), ufsx)) serveMux.HandleFunc("/"+path.Join(prefix, "upload"), func(w http.ResponseWriter, r *http.Request) { defer func() {