Finished subpath implementation

This commit is contained in:
2022-01-31 10:20:19 +01:00
parent 6ac80f8647
commit bc4c27cff3
3 changed files with 5 additions and 8 deletions

View File

@@ -5,10 +5,11 @@ import (
"net/http"
"os"
"path/filepath"
"strings"
)
func ServePath(w http.ResponseWriter, r *http.Request) {
path := filepath.Join(config.FrontendDir, r.URL.Path)
path := filepath.Join(config.FrontendDir, strings.TrimPrefix(r.URL.Path, config.Prefix))
if _, err := os.Stat(path); os.IsNotExist(err) {
Error404(w, r)
} else {