* fix(inbound): preserve literal backslash-n sequences in Windows paths
The normalizeInboundTextNewlines function was converting literal backslash-n
sequences (\n) to actual newlines, corrupting Windows paths like
C:\Work\nxxx\README.md when sent through WebUI.
This fix removes the .replaceAll("\\n", "\n") operation, preserving
literal backslash-n sequences while still normalizing actual CRLF/CR to LF.
Fixes #7968
* fix(test): set RawBody to Windows path so BodyForAgent fallback chain tests correctly
* fix: tighten Windows path newline regression coverage (#11547) (thanks @mcaxtr)
---------
Co-authored-by: Peter Steinberger <steipete@gmail.com>
7 lines
360 B
TypeScript
7 lines
360 B
TypeScript
export function normalizeInboundTextNewlines(input: string): string {
|
|
// Normalize actual newline characters (CR+LF and CR to LF).
|
|
// Do NOT replace literal backslash-n sequences (\\n) as they may be part of
|
|
// Windows paths like C:\Work\nxxx\README.md or user-intended escape sequences.
|
|
return input.replaceAll("\r\n", "\n").replaceAll("\r", "\n");
|
|
}
|