Fix regression in importation of custom lists

Reported by:
- https://github.com/uBlock-user:

Imported custom list were incorrectly seen as out of
date immediately after import operation.

Regression from:
- e27328f931

A few lines of code were improperly removed during
refactoring.
This commit is contained in:
Raymond Hill 2019-09-17 07:44:19 -04:00
parent 0051f3b5c7
commit 26235d80d0
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 9 additions and 3 deletions

View File

@ -695,6 +695,12 @@ api.get = async function(assetKey, options = {}) {
? await api.fetchFilterList(contentURL) ? await api.fetchFilterList(contentURL)
: await api.fetchText(contentURL); : await api.fetchText(contentURL);
if ( details.content === '' ) { continue; } if ( details.content === '' ) { continue; }
if ( reIsExternalPath.test(contentURL) && options.dontCache !== true ) {
assetCacheWrite(assetKey, {
content: details.content,
url: contentURL,
});
}
return reportBack(details.content, contentURL); return reportBack(details.content, contentURL);
} }
return reportBack('', '', 'ENOTFOUND'); return reportBack('', '', 'ENOTFOUND');

View File

@ -268,9 +268,9 @@
} }
const newSet = new Set(newKeys); const newSet = new Set(newKeys);
// Purge unused filter lists from cache. // Purge unused filter lists from cache.
for ( let i = 0, n = oldKeys.length; i < n; i++ ) { for ( const oldKey of oldKeys ) {
if ( newSet.has(oldKeys[i]) === false ) { if ( newSet.has(oldKey) === false ) {
this.removeFilterList(oldKeys[i]); this.removeFilterList(oldKey);
} }
} }
newKeys = Array.from(newSet); newKeys = Array.from(newSet);