diff --git a/files.go b/files.go index 97ba543..6097906 100644 --- a/files.go +++ b/files.go @@ -8,7 +8,7 @@ import ( "path/filepath" ) -const fileElement = "

%v

" +const fileElement = "

%v

" func filesRequest(w http.ResponseWriter, r *http.Request) { partPath := filepath.Clean(r.URL.Path) @@ -38,7 +38,7 @@ func filesRequest(w http.ResponseWriter, r *http.Request) { if f.IsDir() { continue } - pageContent += fmt.Sprintf(fileElement, partPath, f.Name()) + pageContent += fmt.Sprintf(fileElement, filepath.Join(partPath, f.Name()), f.Name()) } } else { http.ServeFile(w, r, path) diff --git a/main.go b/main.go index 1bb4e6f..8dfef04 100644 --- a/main.go +++ b/main.go @@ -88,7 +88,7 @@ func setupBackend(mux *http.ServeMux) { func setupWebsite(mux *http.ServeMux) { url, _ := url.Parse("https://localhost:30000") mux.Handle("rpg.darkstorm.tech/", httputil.NewSingleHostReverseProxy(url)) - mux.HandleFunc("GET /files", filesRequest) + mux.HandleFunc("GET /files/{w...}", filesRequest) mux.HandleFunc("GET /portfolio", portfolioRequest) mux.HandleFunc("/", mainHandle) }