Skip to content

Conversation

@Krish-876
Copy link

Fix double write when refusing hidden files in contents handler

When a request targets a hidden file or directory and allow_hidden is false,
the contents handler finishes a 404 response but continues execution and later
attempts to write again. This results in a secondary
RuntimeError: Cannot write() after finish().

This change adds an early return after finishing the error response, preventing
further processing and avoiding the double write, without changing behavior.

Fixes #1563

@krassowski krassowski added the bug label Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exception when trying serve hidden file or directory

2 participants