1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Generator: Fixed issue with handling of CRLF in ignore file (#4956)

This commit is contained in:
JackGruber 2021-05-13 09:54:27 +02:00 committed by GitHub
parent 1a84ca204e
commit ce80d7e883
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -41,7 +41,7 @@ function mergePackageKey(parentKey, source, dest) {
} }
function mergeIgnoreFile(source, dest) { function mergeIgnoreFile(source, dest) {
const output = dest.trim().split('\n').concat(source.trim().split('\n')); const output = dest.trim().split(/\r?\n/).concat(source.trim().split(/\r?\n/));
return `${output.filter(function(item, pos) { return `${output.filter(function(item, pos) {
if (!item) return true; // Leave blank lines if (!item) return true; // Leave blank lines

View File

@ -33,6 +33,9 @@ describe('utils', () => {
const testCases = [ const testCases = [
['line1\nline2\n', 'newline\n', 'line1\nline2\nnewline\n'], ['line1\nline2\n', 'newline\n', 'line1\nline2\nnewline\n'],
['line1\nline2\n', 'line1\nnewline\n', 'line1\nline2\nnewline\n'], ['line1\nline2\n', 'line1\nnewline\n', 'line1\nline2\nnewline\n'],
['line1\r\nline2\r\n', 'line1\nnewline\n', 'line1\nline2\nnewline\n'],
['line1\nline2\n', 'line1\r\nnewline\r\n', 'line1\nline2\nnewline\n'],
['line1\r\nline2\r\n', 'line1\r\nnewline\r\n', 'line1\nline2\nnewline\n'],
]; ];
for (const t of testCases) { for (const t of testCases) {