Skip to content

Commit bd3590f

Browse files
fix(server): multi-line guest messages keep the line breaks the guest typed
Form data sends every line break in a text field as CRLF, so a multi-line guest message under the 4,000-character limit could be refused as too long, and accepted ones were stored with CRLF. readSubmission now turns CRLF back into LF in the multipart text field before decoding it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 268b2a7 commit bd3590f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎apps/server/src/guest/http.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,12 @@ export const readSubmission = Effect.gen(function* () {
189189
}),
190190
),
191191
);
192-
const fields = yield* decodeSubmit({ shareId: parts.shareId, text: parts.text ?? "" }).pipe(
193-
Effect.option,
194-
);
192+
const text = parts.text ?? "";
193+
const fields = yield* decodeSubmit({
194+
shareId: parts.shareId,
195+
// Form data sends every line break as CRLF; the textarea gave the guest LF.
196+
text: typeof text === "string" ? text.replaceAll("\r\n", "\n") : text,
197+
}).pipe(Effect.option);
195198
if (fields._tag === "None") return null;
196199
const files = parts.file;
197200
const uploads: ReadonlyArray<GuestUpload> = Array.isArray(files)

0 commit comments

Comments
 (0)