Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: escape single fetch transfer #9084

Merged
merged 2 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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