Fix events: return 404 for deleted/missing calendar entries

The before_request handler loaded the entry but didn't abort when it was
None, causing template UndefinedError when building URLs with entry.id.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 10:41:40 +00:00
parent 0c4682e4d7
commit 69a0989b7a

View File

@@ -50,6 +50,7 @@ def register():
@bp.before_request
async def load_entry():
"""Load the calendar entry from the URL parameter."""
from quart import abort
entry_id = request.view_args.get("entry_id")
if entry_id:
result = await g.s.execute(
@@ -60,6 +61,8 @@ def register():
)
)
g.entry = result.scalar_one_or_none()
if g.entry is None:
abort(404)
@bp.context_processor
async def inject_entry():