Skip to content

Commit

Permalink
fix: make sure referer has priority over external resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Nov 21, 2024
1 parent 4cf5527 commit 656f1f5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion har2tree/har2tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,11 @@ def _make_subtree(self, root: URLNode, nodes_to_attach: list[URLNode] | None=Non
# We have a lot of false positives
# 2021-06-19: or the URL of the final redirect is somewhere in an embeded content. In that case, we don't want to attach to the sub-node.
continue
matching_urls = [url_node for url_node in self.all_url_requests[link] if url_node in self._nodes_list]
# 2024-11-21: if the node with that URL has a referer, it will be processed in the referer section.
# we can land in this situation if a node with a referer set attempts to attach child nodes based on external ressources URLs
matching_urls = [url_node for url_node in self.all_url_requests[link]
if url_node in self._nodes_list
and not hasattr(url_node, 'referer')]
self._nodes_list = [node for node in self._nodes_list if node not in matching_urls]
if dev_debug:
self.logger.warning(f'Found from {unode.name} via external ressources ({external_tag}): {matching_urls}.')
Expand Down

0 comments on commit 656f1f5

Please sign in to comment.