Skip to content

Commit 18ae44a

Browse files
committed
fix: Do not attach children to nodes with no redirects and empty response
1 parent d0384a6 commit 18ae44a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

har2tree/har2tree.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,8 +775,13 @@ def _make_subtree(self, root: URLNode, nodes_to_attach: list[URLNode] | None=Non
775775
else:
776776
self.logger.warning(f'The URLNode has a redirect to something we already processed ({unode.redirect_url}), this should not happen.')
777777

778-
# The node can have a redirect, but also trigger ressources refering to themselves, we need to trigger this code on each node.
778+
# 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)
779+
# Example: A POST to self that triggers the **parent** to load an other URL. In this case,
780+
# the proper attachment point is the parent, not this node, even if we have other nodes with this node URL as a referer.
781+
if unode.empty_response:
782+
continue
779783

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

0 commit comments

Comments
 (0)