Skip to content

Commit

Permalink
fix: Do not attach children to nodes with no redirects and empty resp…
Browse files Browse the repository at this point in the history
…onse
  • Loading branch information
Rafiot committed Feb 6, 2025
1 parent d0384a6 commit 18ae44a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion har2tree/har2tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,13 @@ def _make_subtree(self, root: URLNode, nodes_to_attach: list[URLNode] | None=Non
else:
self.logger.warning(f'The URLNode has a redirect to something we already processed ({unode.redirect_url}), this should not happen.')

# The node can have a redirect, but also trigger ressources refering to themselves, we need to trigger this code on each node.
# 2025-02-06: If a node has no redirect **and** no content (empty response), we don't want to attach anything to it (it is a leaf)
# Example: A POST to self that triggers the **parent** to load an other URL. In this case,
# the proper attachment point is the parent, not this node, even if we have other nodes with this node URL as a referer.
if unode.empty_response:
continue

# The node can have a redirect, but also trigger ressources refering to themselves, we need to trigger this code on each node.
if self.all_initiator_url.get(unode.name):
# The URL (unode.name) is in the list of known urls initiating calls
for u in self.all_initiator_url[unode.name]:
Expand Down

0 comments on commit 18ae44a

Please sign in to comment.