Extend support for differential updates to imported lists

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3028
This commit is contained in:
Raymond Hill 2023-12-19 11:01:40 -05:00
parent d13cd30043
commit 443c1f81e1
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 13 additions and 2 deletions

View File

@ -1204,8 +1204,19 @@ const getAssetDiffDetails = assetKey => {
out.writeTime = cacheEntry.writeTime;
const assetEntry = assetSourceRegistry[assetKey];
if ( assetEntry === undefined ) { return; }
if ( Array.isArray(assetEntry.cdnURLs) === false ) { return; }
out.cdnURLs = assetEntry.cdnURLs.slice();
if ( Array.isArray(assetEntry.cdnURLs) ) {
out.cdnURLs = assetEntry.cdnURLs.slice();
} else if ( reIsExternalPath.test(assetKey) ) {
out.cdnURLs = [ assetKey ];
} else if ( typeof assetEntry.contentURL === 'string' ) {
out.cdnURLs = [ assetEntry.contentURL ];
} else if ( Array.isArray(assetEntry.contentURL) ) {
out.cdnURLs = assetEntry.contentURL.slice(0).filter(url =>
reIsExternalPath.test(url)
);
}
if ( Array.isArray(out.cdnURLs) === false ) { return; }
if ( out.cdnURLs.length === 0 ) { return; }
return out;
};