forked from ryanmwangi/CalMerger
fix(lineendings): normalize calendar line endings to CRLF
This commit is contained in:
parent
d15d0be707
commit
379a79617b
|
@ -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);
|
||||||
|
|
|
@ -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 () => {
|
||||||
|
|
Loading…
Reference in New Issue