fix(lineendings): normalize calendar line endings to CRLF

This commit is contained in:
Ryan Mwangi 2024-11-19 19:06:22 +03:00
parent d15d0be707
commit 379a79617b
2 changed files with 2 additions and 2 deletions

View File

@ -151,7 +151,7 @@ export function addEventsToCalendar(calendarComponent, results, overrideFlag = f
// Save calendar data to file // Save calendar data to file
export function saveCalendarFile(filename, content) { export function saveCalendarFile(filename, content) {
const normalizedContent = content.replace(/\r\n/g, '\n').trimEnd(); // Normalize to LF const normalizedContent = content.replace(/\r?\n/g, '\r\n').trimEnd(); // Normalize to CRLF
const filePath = path.join(MERGED_CALENDARS_DIR, filename); const filePath = path.join(MERGED_CALENDARS_DIR, filename);
// console.log(`Saving calendar data to file: ${filePath}`); // console.log(`Saving calendar data to file: ${filePath}`);
fs.writeFileSync(filePath, normalizedContent); fs.writeFileSync(filePath, normalizedContent);

View File

@ -12,7 +12,7 @@ process.chdir(__dirname)
// console.log(process.cwd()); // console.log(process.cwd());
const app = require('../src/server').default; const app = require('../src/server').default;
const normalizeLineEndings = (str) => str.replace(/\r\n/g, '\n').trimEnd(); const normalizeLineEndings = (str) => str.replace(/\r\n/g, '\r\n').trimEnd(); // Normalize to CRLF
describe('Calendar Merging API', () => { describe('Calendar Merging API', () => {
beforeAll(async () => { beforeAll(async () => {