Fix prefix links on prefix length page with URL encoding

- Add urlEncode template function to properly encode prefix URLs
- Move prefix_length.html to embedded templates with function map
- Prevents broken links for prefixes containing slashes
This commit is contained in:
2025-07-28 22:00:27 +02:00
parent 7d39bd18bc
commit 9518519208
4 changed files with 178390 additions and 1365 deletions

View File

@@ -5,7 +5,6 @@ import (
"context"
"encoding/json"
"errors"
"html/template"
"net"
"net/http"
"net/url"
@@ -838,7 +837,7 @@ func (s *Server) handlePrefixLength() http.HandlerFunc {
default:
}
tmpl := template.Must(template.ParseFiles("internal/templates/prefix_length.html"))
tmpl := templates.PrefixLengthTemplate()
if err := tmpl.Execute(w, data); err != nil {
s.logger.Error("Failed to render prefix length template", "error", err)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)