fix(xml saving): if the stirng has

\r we now flatten it so its proper and not create a new folder
This commit is contained in:
2025-10-03 15:00:14 -05:00
parent 92043d8118
commit 6f4e987ec4

View File

@@ -2,12 +2,18 @@ import fs from "fs";
import path from "path";
import { createLog } from "../../logger/logger.js";
const cleanStringForFilename = (str: string) => {
// Remove CRLF and LF newlines
return str.replace(/(\r\n|\n|\r)/gm, " "); // or "" if you want no space at all
};
/**
* Save XML string to /xml/ with timestamp in name
* @param xmlContent The XML string
* @param prefix File prefix (ex: request or response)
*/
export const saveXml = (xmlContent: string, prefix: string = "request") => {
export const saveXml = (xmlContent: string, nameString: string = "request") => {
const prefix = cleanStringForFilename(nameString);
try {
const now = new Date();