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

Add details to exception to see where we're going wrong

This commit is contained in:
Tessa Walsh 2024-11-05 11:49:42 -05:00
parent a5a5d1c6d3
commit 27cf0e70a3

View File

@ -44,8 +44,7 @@ class StaticHandler(object):
try:
validate_requested_file_path(static_path_to_validate, url)
except ValueError:
raise NotFoundException('Static File Not Found: ' +
url_str)
raise NotFoundException(f'Static File {url_str} (simplified: {url}) not found in {static_path_to_validate}')
try:
data = self.block_loader.load(full_path)
@ -81,7 +80,7 @@ class StaticHandler(object):
url_str)
def validate_requested_file_path(self, static_dir, requested_path):
"""Validate that requested file path is within static dir.
"""Validate that requested relative file path is within static dir.
Returns relative path starting from static_dir or raises ValueError if
requested path is not in the static directory.