Skip to content

Commit 98e7ed7

Browse files
committed
Encode unmodified html as well
1 parent fa5c895 commit 98e7ed7

File tree

1 file changed

+2
-2
lines changed
  • packages/react-router/src/cloudflare

1 file changed

+2
-2
lines changed

packages/react-router/src/cloudflare/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ export function injectTraceMetaTags(body: ReadableStream): ReadableStream {
2323
return;
2424
}
2525

26+
const encoder = new TextEncoder();
2627
const html = value instanceof Uint8Array ? new TextDecoder().decode(value) : String(value);
2728

2829
if (html.includes(headClosingTag)) {
2930
const modifiedHtml = html.replace(headClosingTag, `${getTraceMetaTags()}${headClosingTag}`);
3031

31-
const encoder = new TextEncoder();
3232
controller.enqueue(encoder.encode(modifiedHtml));
3333
return;
3434
}
3535

36-
controller.enqueue(value);
36+
controller.enqueue(encoder.encode(html));
3737
},
3838
});
3939

0 commit comments

Comments
 (0)