back to "old" way to parse url because it dont work with more than 2 "/"

This commit is contained in:
2025-12-17 14:22:40 +02:00
parent 4be8faaa67
commit b92682177c

View File

@@ -34,7 +34,7 @@ func Route(config *config.Config) func(chi.Router) {
cfg: config, cfg: config,
} }
return func(r chi.Router) { return func(r chi.Router) {
r.Get("/{blockPath}", h.handleBlock) r.Get("/*", h.handleBlock)
} }
} }
@@ -44,7 +44,7 @@ func (h *blockHandler) handleBlock(w http.ResponseWriter, r *http.Request) {
return return
} }
blockPath := chi.URLParam(r, "blockPath") blockPath := r.URL.Path[len("/api/block/"):]
block, err := LoadBlock(blockPath, h.cfg) block, err := LoadBlock(blockPath, h.cfg)
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)