From 9ec8d562f51e5bf236eeed0b5d5b2ebcc57710dc Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 20 Jul 2020 12:59:11 +0100 Subject: [PATCH 1/2] Fix staticfiles 404 errors --- starlette/staticfiles.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/starlette/staticfiles.py b/starlette/staticfiles.py index 4ea2f1b5a..22b9d3ae6 100644 --- a/starlette/staticfiles.py +++ b/starlette/staticfiles.py @@ -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: From bb77669f2004e32ed3813aeef3c9357a4da57f59 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 20 Jul 2020 13:07:36 +0100 Subject: [PATCH 2/2] Version 0.13.6 --- docs/release-notes.md | 4 ++++ starlette/__init__.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index 3b0e73513..83f7e91a7 100644 --- a/docs/release-notes.md +++ b/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. diff --git a/starlette/__init__.py b/starlette/__init__.py index 7c37594d8..e318db396 100644 --- a/starlette/__init__.py +++ b/starlette/__init__.py @@ -1 +1 @@ -__version__ = "0.13.5" +__version__ = "0.13.6"