Skip to content

Commit

Permalink
fix #1514 error header sanitization
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed Jun 18, 2024
1 parent 9da8b18 commit ae6ca2e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-ears-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solidjs/start": patch
---

fix #1514 error header sanitization
22 changes: 11 additions & 11 deletions packages/start/src/runtime/server-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import { crossSerializeStream, fromJSON, getCrossReferenceHeader } from "seroval";
// @ts-ignore
import {
CustomEventPlugin,
DOMExceptionPlugin,
EventPlugin,
FormDataPlugin,
HeadersPlugin,
ReadableStreamPlugin,
RequestPlugin,
ResponsePlugin,
URLPlugin,
URLSearchParamsPlugin
CustomEventPlugin,
DOMExceptionPlugin,
EventPlugin,
FormDataPlugin,
HeadersPlugin,
ReadableStreamPlugin,
RequestPlugin,
ResponsePlugin,
URLPlugin,
URLSearchParamsPlugin
} from "seroval-plugins/web";
import { sharedConfig } from "solid-js";
import { renderToString } from "solid-js/web";
Expand Down Expand Up @@ -202,7 +202,7 @@ async function handleServerFunction(h3Event: HTTPEvent) {
setHeader(h3Event, "X-Error", "true");
} else if (instance) {
const error = x instanceof Error ? x.message : typeof x === "string" ? x : "true";
setHeader(h3Event, "X-Error", error);
setHeader(h3Event, "X-Error", error.replace(/[\r\n]+/g, ""));
} else {
x = handleNoJS(x, request, parsed, true);
}
Expand Down

0 comments on commit ae6ca2e

Please sign in to comment.