Skip to content

Commit

Permalink
backwards support
Browse files Browse the repository at this point in the history
  • Loading branch information
aminalaee committed Apr 20, 2022
1 parent 40b66a2 commit e201817
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion starlette/staticfiles.py
Expand Up @@ -159,7 +159,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 e201817

Please sign in to comment.