/prefix/{prefix}/{len} and /api/v1/prefix/{prefix}/{len} passed the URL text to the database lookup as typed. A prefix that does not parse, such as foo/24, answered 500 and was logged as a server error; a valid prefix written in a form other than the one the tables store (2001:DB8:0:0::/32 for a stored 2001:db8::/32, 192.0.2.1/24 for 192.0.2.0/24) answered 404.
Both handlers now parse the prefix with net/netip, mask it and look up the text form it prints, which is the form the tables store since #48. A prefix that does not parse answers 400: the JSON endpoint gives the parse error as its message, the HTML page says "Invalid prefix".
Worth knowing: the prefix field of the JSON answer, and the prefix the HTML page shows, are now the stored form rather than what the URL said, so /api/v1/prefix/192.0.2.1/24 answers with "prefix": "192.0.2.0/24".
The new test drives both pages through the router against a real database.
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/routewatch/issues/71.
`/prefix/{prefix}/{len}` and `/api/v1/prefix/{prefix}/{len}` passed the URL text to the database lookup as typed. A prefix that does not parse, such as `foo/24`, answered 500 and was logged as a server error; a valid prefix written in a form other than the one the tables store (`2001:DB8:0:0::/32` for a stored `2001:db8::/32`, `192.0.2.1/24` for `192.0.2.0/24`) answered 404.
Both handlers now parse the prefix with `net/netip`, mask it and look up the text form it prints, which is the form the tables store since https://git.eeqj.de/sneak/routewatch/issues/48. A prefix that does not parse answers 400: the JSON endpoint gives the parse error as its message, the HTML page says "Invalid prefix".
Worth knowing: the `prefix` field of the JSON answer, and the prefix the HTML page shows, are now the stored form rather than what the URL said, so `/api/v1/prefix/192.0.2.1/24` answers with `"prefix": "192.0.2.0/24"`.
The new test drives both pages through the router against a real database.
Model: opus-5-5
Both prefix pages passed the URL text to the lookup as typed. A prefix
that does not parse made the lookup fail with an error that was not "no
route found", so the pages answered 500; a valid prefix written in any
form other than the one the tables store answered 404 although the
route exists. Both handlers now parse the prefix with net/netip, mask
it and look up the text form it prints, and answer 400 for a prefix
that does not parse.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #71.
/prefix/{prefix}/{len}and/api/v1/prefix/{prefix}/{len}passed the URL text to the database lookup as typed. A prefix that does not parse, such asfoo/24, answered 500 and was logged as a server error; a valid prefix written in a form other than the one the tables store (2001:DB8:0:0::/32for a stored2001:db8::/32,192.0.2.1/24for192.0.2.0/24) answered 404.Both handlers now parse the prefix with
net/netip, mask it and look up the text form it prints, which is the form the tables store since #48. A prefix that does not parse answers 400: the JSON endpoint gives the parse error as its message, the HTML page says "Invalid prefix".Worth knowing: the
prefixfield of the JSON answer, and the prefix the HTML page shows, are now the stored form rather than what the URL said, so/api/v1/prefix/192.0.2.1/24answers with"prefix": "192.0.2.0/24".The new test drives both pages through the router against a real database.
Model: opus-5-5
Review passed.
Model: opus-5-5