Fix prefix URL routing by using URL encoding
- Replace slash-to-dash conversion with proper URL encoding - Update handlePrefixDetail and handlePrefixDetailJSON to URL decode prefix parameter - Update handleIPRedirect to URL encode the prefix in the redirect - Add urlEncode template function for use in templates - Update AS detail template to URL encode prefix links - This properly handles the slash in CIDR notation (e.g., /prefix/192.168.1.0%2F24)
This commit is contained in:
@@ -178,7 +178,7 @@
|
||||
<tbody>
|
||||
{{range .IPv4Prefixes}}
|
||||
<tr>
|
||||
<td><a href="/prefix/{{.Prefix}}" class="prefix-link">{{.Prefix}}</a></td>
|
||||
<td><a href="/prefix/{{.Prefix | urlEncode}}" class="prefix-link">{{.Prefix}}</a></td>
|
||||
<td>/{{.MaskLength}}</td>
|
||||
<td>{{.LastUpdated.Format "2006-01-02 15:04:05"}}</td>
|
||||
<td class="age">{{.LastUpdated | timeSince}}</td>
|
||||
@@ -207,7 +207,7 @@
|
||||
<tbody>
|
||||
{{range .IPv6Prefixes}}
|
||||
<tr>
|
||||
<td><a href="/prefix/{{.Prefix}}" class="prefix-link">{{.Prefix}}</a></td>
|
||||
<td><a href="/prefix/{{.Prefix | urlEncode}}" class="prefix-link">{{.Prefix}}</a></td>
|
||||
<td>/{{.MaskLength}}</td>
|
||||
<td>{{.LastUpdated.Format "2006-01-02 15:04:05"}}</td>
|
||||
<td class="age">{{.LastUpdated | timeSince}}</td>
|
||||
|
||||
Reference in New Issue
Block a user