Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.13.6 #1006

Merged
merged 2 commits into from Jul 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/release-notes.md
@@ -1,3 +1,7 @@
## 0.13.6

* Fix 404 errors with `StaticFiles`.

## 0.13.5

* Add support for `Starlette(lifespan=...)` functions.
Expand Down
2 changes: 1 addition & 1 deletion starlette/__init__.py
@@ -1 +1 @@
__version__ = "0.13.5"
__version__ = "0.13.6"
8 changes: 3 additions & 5 deletions starlette/staticfiles.py
Expand Up @@ -140,11 +140,9 @@ async def lookup_path(
self, path: str
) -> typing.Tuple[str, typing.Optional[os.stat_result]]:
for directory in self.all_directories:
full_path = os.path.join(directory, path)
if (
os.path.commonprefix([os.path.realpath(full_path), directory])
!= directory
):
full_path = os.path.realpath(os.path.join(directory, path))
directory = os.path.realpath(directory)
if os.path.commonprefix([full_path, directory]) != directory:
# Don't allow misbehaving clients to break out of the static files directory.
continue
try:
Expand Down