Fix prefix URL routing for encoded CIDR notation
Change route from wildcard /prefix/* to explicit /prefix/{prefix}/{len}
to properly handle URL-encoded IPv6 addresses with CIDR notation.
- Separate prefix and length into individual path parameters
- Add prefixURL template function for generating correct links
- Remove url.QueryUnescape from handlers (chi handles decoding)
This commit is contained in:
@@ -28,7 +28,7 @@ func (s *Server) setupRoutes() {
|
||||
|
||||
// AS and prefix detail pages
|
||||
r.Get("/as/{asn}", s.handleASDetail())
|
||||
r.Get("/prefix/*", s.handlePrefixDetail())
|
||||
r.Get("/prefix/{prefix}/{len}", s.handlePrefixDetail())
|
||||
r.Get("/prefixlength/{length}", s.handlePrefixLength())
|
||||
r.Get("/prefixlength6/{length}", s.handlePrefixLength6())
|
||||
|
||||
@@ -45,7 +45,7 @@ func (s *Server) setupRoutes() {
|
||||
r.Get("/stats", s.handleStats())
|
||||
r.Get("/ip/{ip}", s.handleIPLookup())
|
||||
r.Get("/as/{asn}", s.handleASDetailJSON())
|
||||
r.Get("/prefix/*", s.handlePrefixDetailJSON())
|
||||
r.Get("/prefix/{prefix}/{len}", s.handlePrefixDetailJSON())
|
||||
})
|
||||
|
||||
s.router = r
|
||||
|
||||
Reference in New Issue
Block a user