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:
parent
1a84ca204e
commit
ce80d7e883
@ -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
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user