Skip to content

Commit

Permalink
Ensure both calls of static_dir are Paths
Browse files Browse the repository at this point in the history
  • Loading branch information
tw4l committed Nov 5, 2024
1 parent 27cf0e7 commit 0717495
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pywb/apps/static_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def __call__(self, environ, url_str):
try:
validate_requested_file_path(static_path_to_validate, url)
except ValueError:
raise NotFoundException(f'Static File {url_str} (simplified: {url}) not found in {static_path_to_validate}')
raise NotFoundException('Static File Not Found: ' +
url_str)

try:
data = self.block_loader.load(full_path)
Expand Down Expand Up @@ -85,7 +86,8 @@ def validate_requested_file_path(self, static_dir, requested_path):
Returns relative path starting from static_dir or raises ValueError if
requested path is not in the static directory.
"""
return Path(static_dir).joinpath(requested_path).resolve().relative_to(static_dir.resolve())
static_dir = Path(static_dir)
return static_dir.joinpath(requested_path).resolve().relative_to(static_dir.resolve())



0 comments on commit 0717495

Please sign in to comment.