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

Fix broken alias nostif

Related feedback:
- ba11a70013 (r45030152)

Regression from:
- ba11a70013
This commit is contained in:
Raymond Hill 2020-12-11 10:34:33 -05:00
parent c41be5b828
commit 24755d4300
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -375,11 +375,11 @@ RedirectEngine.prototype.resourcesFromString = function(text) {
if ( line.startsWith('/// ') ) {
if ( details === undefined ) {
details = {};
details = [];
}
const [ prop, value ] = line.slice(4).trim().split(/\s+/);
if ( value !== undefined ) {
details[prop] = value;
details.push({ prop, value });
}
continue;
}
@ -401,8 +401,11 @@ RedirectEngine.prototype.resourcesFromString = function(text) {
RedirectEntry.fromContent(mime, content)
);
if ( details instanceof Object && details.alias ) {
this.aliases.set(details.alias, name);
if ( Array.isArray(details) ) {
for ( const { prop, value } of details ) {
if ( prop !== 'alias' ) { continue; }
this.aliases.set(value, name);
}
}
fields = undefined;