Changeset 59e522f in Klonkt


Ignore:
Timestamp:
06/19/2026 08:18:26 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
13b2986
Parents:
3b6e04a
Message:

404: unknown slug now falls through to the proper 404 page (instead of "Post not found")

postsRoutes /:slug matched every unknown slug and sent plain text, so the nice
catch-all was never reached. Now next() when no site/post found -> the proper
responsive 404.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/posts.js

    r3b6e04a r59e522f  
    399399
    400400  const site = res.locals.site;
    401   if (!site) return res.status(404).send('Site not found');
     401  if (!site) return next(); // -> nette 404 catch-all
    402402
    403403  const post = db.prepare(`
     
    407407  `).get(site.id, req.params.slug);
    408408
    409   if (!post) return res.status(404).send('Post not found');
     409  if (!post) return next(); // onbekende slug -> nette 404 catch-all
    410410
    411411  // Permission to view: published OR (logged in + can edit)
Note: See TracChangeset for help on using the changeset viewer.