From 244c453ff2c64326eca6e4f287e460e1bcfe6bc5 Mon Sep 17 00:00:00 2001 From: Jipok Date: Fri, 23 Feb 2024 17:28:07 +0500 Subject: [PATCH 1/2] ui: update webdavjs.html and make_html.sh --- internal/server/make_html.sh | 24 +++++++++++++++ internal/server/webdavjs.html | 57 +++++++++++++++++++++++++++++++++-- 2 files changed, 79 insertions(+), 2 deletions(-) create mode 100755 internal/server/make_html.sh diff --git a/internal/server/make_html.sh b/internal/server/make_html.sh new file mode 100755 index 0000000..8ef5baf --- /dev/null +++ b/internal/server/make_html.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +rm webdavjs.html +cat > webdavjs.html < + + + + + + GoWebDAV + + + " >> webdavjs.html \ No newline at end of file diff --git a/internal/server/webdavjs.html b/internal/server/webdavjs.html index 85dfb4e..fafee13 100644 --- a/internal/server/webdavjs.html +++ b/internal/server/webdavjs.html @@ -8,9 +8,62 @@ + From 31dbf5e9648d5de9e8515e5cede6359e95d1332e Mon Sep 17 00:00:00 2001 From: Jipok Date: Fri, 23 Feb 2024 17:29:42 +0500 Subject: [PATCH 2/2] fix: show ui on all path with / on end --- internal/server/handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/server/handler.go b/internal/server/handler.go index d7a361e..b9e02fa 100644 --- a/internal/server/handler.go +++ b/internal/server/handler.go @@ -81,7 +81,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, req *http.Request) { } log.Debug().Str("URL", req.URL.Path).Str("Method", req.Method).Msg("Handler Request") - if req.Method == "GET" && (req.URL.Path == h.prefix || req.URL.Path == h.prefix+"/") { + if req.Method == "GET" && (req.URL.Path == h.prefix || strings.HasSuffix(req.URL.Path, "/")) { if _, err := w.Write([]byte(WebdavjsHTML)); err != nil { log.Error().Err(err).Msg("Failed to write index.html") }