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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user