Skip to content

Commit

Permalink
fix: escape single fetch transfer (remix-run#9084)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-ebey authored Mar 19, 2024
1 parent ce5cfe0 commit 283df54
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/shy-buttons-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"remix": patch
"@remix-run/react": patch
---

fix: escape single fetch transfer
5 changes: 3 additions & 2 deletions packages/remix-react/single-fetch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { decode } from "turbo-stream";

import { createRequestInit } from "./data";
import type { AssetsManifest, EntryContext } from "./entry";
import { escapeHtml } from "./markup";
import type { RouteModules } from "./routeModules";
import invariant from "./invariant";

Expand Down Expand Up @@ -74,8 +75,8 @@ export function StreamTransfer({
let scriptTag = value ? (
<script
dangerouslySetInnerHTML={{
__html: `window.__remixContext.streamController.enqueue(${JSON.stringify(
value
__html: `window.__remixContext.streamController.enqueue(${escapeHtml(
JSON.stringify(value)
)});`,
}}
/>
Expand Down

0 comments on commit 283df54

Please sign in to comment.