Skip to content

fix(app): escape chart data in the standalone chart export - #106

Open
asasemahmed wants to merge 1 commit into
CopilotKit:mainfrom
asasemahmed:fix/app-chart-export-escape
Open

asasemahmed wants to merge 1 commit into
CopilotKit:mainfrom
asasemahmed:fix/app-chart-export-escape

Conversation

@asasemahmed

Copy link
Copy Markdown

chartToStandaloneHtml inserts labels, values and colors into an inline <script> with plain JSON.stringify, which leaves </script> as is. A chart label containing </script> therefore closes the script tag, and the exported file either breaks or runs whatever follows. The labels come from model output. assembleStandaloneHtmlFromActivity already escapes </script, so the two exports behave differently.

The values now go through a small toScriptJson helper that escapes < as <. It is the same value in JS, but it cannot close the tag.

Tests: a label of </script><script>...</script> leaves only the two expected </script> tags in the output.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant