StaticFiles
causes Internal Server Error when user accesses existing files as directory
#1123
Closed
2 tasks done
Labels
staticfiles
Static file serving
Checklist
master
.Describe the bug
StaticFiles
causes Internal Server Error when user accesses existing files as directory (e.g./static/somefile.txt/foobar
)To reproduce
python -m venv venv && source venv/bin/activate
pip install starlette uvicorn aiofiles
directory structure:
poc.py
uvicorn poc:app
http://127.0.0.1:8000/static/sample.txt/foo
Expected behavior
StaticFiles
returns "404 Not Found" HTTP response (as Apache HTTP Server and Nginx does).Actual behavior
StaticFiles
returns "500 Internal Server Error" HTTP response.Debugging material
console log with tracebacks:
Environment
Additional context
Apache HTTP Server and Nginx treat this case (access existing file as directory) as "404 Not Found".
Samples:
The text was updated successfully, but these errors were encountered: