mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-02 00:42:45 +01:00
Properly report network error condition when importing filter list
Before this commit, a network error condition was not reported when the filter list was imported, it was only reported afterward when the imported filter list was updated.
This commit is contained in:
parent
d31e14995e
commit
189bdd685f
@ -787,6 +787,7 @@ assets.get = async function(assetKey, options = {}) {
|
|||||||
contentURLs.push(...assetDetails.cdnURLs);
|
contentURLs.push(...assetDetails.cdnURLs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let error = 'ENOTFOUND';
|
||||||
for ( const contentURL of contentURLs ) {
|
for ( const contentURL of contentURLs ) {
|
||||||
if ( reIsExternalPath.test(contentURL) && assetDetails.hasLocalURL ) {
|
if ( reIsExternalPath.test(contentURL) && assetDetails.hasLocalURL ) {
|
||||||
continue;
|
continue;
|
||||||
@ -794,6 +795,9 @@ assets.get = async function(assetKey, options = {}) {
|
|||||||
const details = assetDetails.content === 'filters'
|
const details = assetDetails.content === 'filters'
|
||||||
? await assets.fetchFilterList(contentURL)
|
? await assets.fetchFilterList(contentURL)
|
||||||
: await assets.fetchText(contentURL);
|
: await assets.fetchText(contentURL);
|
||||||
|
if ( details.error !== undefined ) {
|
||||||
|
error = details.error;
|
||||||
|
}
|
||||||
if ( details.content === '' ) { continue; }
|
if ( details.content === '' ) { continue; }
|
||||||
if ( reIsExternalPath.test(contentURL) && options.dontCache !== true ) {
|
if ( reIsExternalPath.test(contentURL) && options.dontCache !== true ) {
|
||||||
assetCacheWrite(assetKey, {
|
assetCacheWrite(assetKey, {
|
||||||
@ -804,7 +808,12 @@ assets.get = async function(assetKey, options = {}) {
|
|||||||
}
|
}
|
||||||
return reportBack(details.content, contentURL);
|
return reportBack(details.content, contentURL);
|
||||||
}
|
}
|
||||||
return reportBack('', '', 'ENOTFOUND');
|
if ( assetRegistry[assetKey] !== undefined ) {
|
||||||
|
registerAssetSource(assetKey, {
|
||||||
|
error: { time: Date.now(), error }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return reportBack('', '', error);
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user