Return 404 for non-numeric like and bookmark IDs #147
Loading…
Reference in a new issue
No description provided.
Delete branch "fix-non-numeric-route-ids"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes a Flare error (#9528114): a request to
/likes/twcamp^share|twsrc^ios|twgr^software.studioh.Indigenous.share-micropub"returned a 500.The
likes/{like}route used route model binding with no constraint, so the junk segment ended up inwhere "id" = '...'. Postgres rejects comparing text to an integer column (SQLSTATE 22P02), which caused the 500.bookmarks/{bookmark}had the same problem.Changes
->whereNumber(...), so non-numeric IDs now return a 404.Likes and bookmarks only ever generate numeric URLs (
/likes/{id},Bookmark::localUri()). They don't use newbase60 like notes do, so no real links are affected.🤖 Generated with Claude Code
Constrain the likes/{like} and bookmarks/{bookmark} routes to numeric IDs. Previously a junk URL such as /likes/twcamp^share|twsrc^ios was passed to route model binding, and Postgres rejected the text-vs-integer comparison with a QueryException, returning a 500 instead of a 404. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>