diff --git a/src/renderer/src/edlFormats.test.ts b/src/renderer/src/edlFormats.test.ts index a151d2b9..9e929bdd 100644 --- a/src/renderer/src/edlFormats.test.ts +++ b/src/renderer/src/edlFormats.test.ts @@ -63,6 +63,16 @@ describe('parseYouTube', () => { { start: 0, end: undefined, name: 'Test 1' }, ]); }); + + // possibly https://github.com/mifi/lossless-cut/issues/2344 + it('Windows crlf', () => { + const str = ' 00:00: Test 1\r\n00:01: Test 2'; + const edl = parseYouTube(str); + expect(edl).toEqual([ + { start: 0, end: 1, name: 'Test 1' }, + { start: 1, end: undefined, name: 'Test 2' }, + ]); + }); }); it('formatYouTube', () => { diff --git a/src/renderer/src/edlFormats.ts b/src/renderer/src/edlFormats.ts index 03b5ea1a..c08945ab 100644 --- a/src/renderer/src/edlFormats.ts +++ b/src/renderer/src/edlFormats.ts @@ -289,7 +289,7 @@ export function parseYouTube(str: string) { return { time, name }; } - const lines = str.split('\n').map((line) => parseLine(line)).flatMap((line) => (line ? [line] : [])); + const lines = str.split(/\r?\n/).map((line) => parseLine(line)).flatMap((line) => (line ? [line] : [])); const linesSorted = sortBy(lines, (l) => l.time);