Make sure variable is None if exception is raised. (#43707)

This commit is contained in:
Kyle Knoepfel 2024-04-18 10:50:15 -05:00 committed by GitHub
parent 3162c2459d
commit 17e0774189
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -707,6 +707,7 @@ def _spider(url: urllib.parse.ParseResult, collect_nested: bool, _visited: Set[s
raw_link = metadata_parser.fragments.pop() raw_link = metadata_parser.fragments.pop()
abs_link = url_util.join(response_url, raw_link.strip(), resolve_href=True) abs_link = url_util.join(response_url, raw_link.strip(), resolve_href=True)
fragment_response_url = None
try: try:
# This seems to be text/html, though text/fragment+html is also used # This seems to be text/html, though text/fragment+html is also used
fragment_response_url, _, fragment_response = read_from_url(abs_link, "text/html") fragment_response_url, _, fragment_response = read_from_url(abs_link, "text/html")