aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
authorgorhill <rhill@raymondhill.net>2015-08-25 10:09:37 -0400
committergorhill <rhill@raymondhill.net>2015-08-25 10:09:37 -0400
commit8f01f7309ef93028832ec7262deaa46f9172ec89 (patch)
tree093fd48841fb9f30385955969282a88ce8c52ad4 /src/js
parent57367c79b940390e24073e8b16b028c1a0c1b437 (diff)
downloaduBlock-8f01f7309ef93028832ec7262deaa46f9172ec89.zip
uBlock-8f01f7309ef93028832ec7262deaa46f9172ec89.tar.gz
uBlock-8f01f7309ef93028832ec7262deaa46f9172ec89.tar.bz2
this fixes #528 + checksums.txt needs patching re. #602
Diffstat (limited to 'src/js')
-rw-r--r--src/js/assets.js29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/js/assets.js b/src/js/assets.js
index b61d6c7..572706f 100644
--- a/src/js/assets.js
+++ b/src/js/assets.js
@@ -432,7 +432,26 @@ var getRepoMetadata = function(callback) {
if ( /^(?:[0-9a-f]{32}\s+\S+(?:\s+|$))+/.test(details.content) === false ) {
return '';
}
- return details.content;
+ // https://github.com/gorhill/uBlock/issues/602
+ // Need to convert old asset entries to new asset entries.
+ // TODO: remove this code once v1.1.0.0 is everywhere.
+ var out = [];
+ var listMap = µBlock.oldListToNewListMap;
+ var lines = details.content.split(/\s*\n\s*/);
+ var line, matches;
+ for ( var i = 0; i < lines.length; i++ ) {
+ line = lines[i];
+ matches = line.match(/^([0-9a-f]+) (.+)$/);
+ if ( matches === null ) {
+ continue;
+ }
+ if ( listMap.hasOwnProperty(matches[2]) ) {
+ out.push(matches[1] + ' ' + listMap[matches[2]]);
+ } else {
+ out.push(line);
+ }
+ }
+ return out.join('\n');
};
var parseChecksums = function(text, which) {
@@ -1082,13 +1101,17 @@ exports.metadata = function(callback) {
// We need to check cache obsolescence when both cache and repo meta data
// has been gathered.
var checkCacheObsolescence = function() {
- var entry;
+ var entry, homeURL;
for ( var path in out ) {
if ( out.hasOwnProperty(path) === false ) {
continue;
}
entry = out[path];
- entry.cacheObsolete = stringIsNotEmpty(homeURLs[path]) &&
+ // https://github.com/gorhill/uBlock/issues/528
+ // Not having a homeURL property does not mean the filter list
+ // is not external.
+ homeURL = reIsExternalPath.test(path) ? path : homeURLs[path];
+ entry.cacheObsolete = stringIsNotEmpty(homeURL) &&
cacheIsObsolete(entry.lastModified);
}
callback(out);