1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

Ensure both calls of static_dir are Paths

This commit is contained in:
Tessa Walsh 2024-11-05 12:02:21 -05:00
parent 27cf0e70a3
commit 071749541f

View File

@ -44,7 +44,8 @@ class StaticHandler(object):
try: try:
validate_requested_file_path(static_path_to_validate, url) validate_requested_file_path(static_path_to_validate, url)
except ValueError: 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: try:
data = self.block_loader.load(full_path) data = self.block_loader.load(full_path)
@ -85,7 +86,8 @@ class StaticHandler(object):
Returns relative path starting from static_dir or raises ValueError if Returns relative path starting from static_dir or raises ValueError if
requested path is not in the static directory. 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())