Return 404 for non-numeric like and bookmark IDs
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>
This commit is contained in:
parent
c3cf597950
commit
7ce256baa5
1 changed files with 16 additions and 2 deletions
|
|
@ -211,14 +211,14 @@ Route::get('note/{id}', [NotesController::class, 'redirect']); // for legacy not
|
|||
// Likes
|
||||
Route::prefix('likes')->group(function () {
|
||||
Route::get('/', [LikesController::class, 'index']);
|
||||
Route::get('/{like}', [LikesController::class, 'show']);
|
||||
Route::get('/{like}', [LikesController::class, 'show'])->whereNumber('like');
|
||||
});
|
||||
|
||||
// Bookmarks
|
||||
Route::prefix('bookmarks')->group(function () {
|
||||
Route::get('/', [BookmarksController::class, 'index']);
|
||||
Route::redirect('/tagged', '/bookmarks');
|
||||
Route::get('/{bookmark}', [BookmarksController::class, 'show']);
|
||||
Route::get('/{bookmark}', [BookmarksController::class, 'show'])->whereNumber('bookmark');
|
||||
Route::get('/tagged/{tag}', [BookmarksController::class, 'tagged']);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue