Skip to content

Commit 9fc39b1

Browse files
committed
chg: Avoid warning when final URL is not in tree.
1 parent dea4e54 commit 9fc39b1

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

har2tree/har2tree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def __init__(self, harfile: Path, capture_uuid: str):
118118
last_redirect = unquote_plus(_lr.read())
119119
self.final_redirect: str = last_redirect
120120
if not self._search_final_redirect():
121-
self.logger.warning(f'Final redirect URL from address bar not in tree: {last_redirect}')
121+
self.logger.info(f'Final redirect URL from address bar not in tree: {last_redirect}')
122122
else:
123123
self.logger.debug('No last_redirect file available.')
124124
self.final_redirect = ''

har2tree/nodes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ def load_har_entry(self, har_entry: MutableMapping[str, Any], all_requests: list
485485

486486
# Common JS redirect we can catch easily
487487
# NOTE: it is extremely fragile and doesn't work very often but is kinda better than nothing.
488+
# NOTE 2025-08-30: Also, finding that doesn't mean it is in a part of the code that is executed without user interaction. It can be triggered after a user fills a form for example.
488489
# Source: https://stackoverflow.com/questions/13363174/regular-expression-to-catch-as-many-javascript-redirections-as-possible
489490
regex = re.compile(br"""((location.href)|(window.location)|(location.replace)|(location.assign))(( ?= ?)|( ?\( ?))("|')([^'"]*)("|')( ?\) ?)?;""", re.I)
490491
matches = re.findall(regex, self.body.getvalue())

0 commit comments

Comments
 (0)