Skip to content

Commit

Permalink
escape HTML characters after truncation
Browse files Browse the repository at this point in the history
  • Loading branch information
zilto committed Nov 13, 2024
1 parent 0106684 commit 132afaf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hamilton/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,10 @@ def _get_node_label(
# because config *values* are passed through this function
# see issue: https://github.com/DAGWorks-Inc/hamilton/issues/1200
# see graphviz ref: https://graphviz.org/doc/info/shapes.html#html
escaped_type_string = html.escape(type_string, quote=True)
if len(escaped_type_string) > MAX_STRING_LENGTH:
escaped_type_string = escaped_type_string[:MAX_STRING_LENGTH] + "[...]"
if len(type_string) > MAX_STRING_LENGTH:
type_string = type_string[:MAX_STRING_LENGTH] + "[...]"

escaped_type_string = html.escape(type_string, quote=True)
return f"<<b>{name}</b><br /><br /><i>{escaped_type_string}</i>>"

def _get_input_label(input_nodes: FrozenSet[node.Node]) -> str:
Expand Down

0 comments on commit 132afaf

Please sign in to comment.