Skip to content

Commit

Permalink
backwards support
Browse files Browse the repository at this point in the history
  • Loading branch information
aminalaee committed Apr 24, 2022
1 parent 11af5c2 commit 2c86a96
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion starlette/staticfiles.py
Expand Up @@ -163,7 +163,11 @@ def lookup_path(
original_path = Path(directory).joinpath(path)
full_path = original_path.resolve()
directory = Path(directory).resolve()
is_internal = full_path.is_relative_to(directory)
try:
full_path.relative_to(directory)
is_internal = True
except ValueError:
is_internal = False
if not is_internal and not original_path.is_symlink():
# Don't allow misbehaving clients to break out of the static files
# directory if not following symlinks.
Expand Down

0 comments on commit 2c86a96

Please sign in to comment.