From 071749541f8e0300560e44de87e44db64754fd48 Mon Sep 17 00:00:00 2001 From: Tessa Walsh Date: Tue, 5 Nov 2024 12:02:21 -0500 Subject: [PATCH] Ensure both calls of static_dir are Paths --- pywb/apps/static_handler.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pywb/apps/static_handler.py b/pywb/apps/static_handler.py index 913240b7..8b7607e2 100644 --- a/pywb/apps/static_handler.py +++ b/pywb/apps/static_handler.py @@ -44,7 +44,8 @@ class StaticHandler(object): 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) @@ -85,7 +86,8 @@ class StaticHandler(object): 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())