1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 15:32:28 +02:00

Discard duplicate lines when merging imported directives

Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/tqwl4s/import_of_the_reliable_sites/
This commit is contained in:
Raymond Hill 2022-03-29 09:49:17 -04:00
parent ecfe47a1ef
commit 0d6a459b60
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -178,9 +178,11 @@ const handleImportFilePicker = function() {
const fr = new FileReader(); const fr = new FileReader();
fr.onload = ev => { fr.onload = ev => {
if ( ev.type !== 'load' ) { return; } if ( ev.type !== 'load' ) { return; }
setEditorText( const content = uBlockDashboard.mergeNewLines(
[ getEditorText().trim(), fr.result.trim() ].join('\n').trim() getEditorText().trim(),
fr.result.trim()
); );
setEditorText(content);
}; };
fr.readAsText(file); fr.readAsText(file);
}; };