From de6cf0e6aaae4e715e1ac325e759cea75ed537e8 Mon Sep 17 00:00:00 2001 From: Hugo Xu Date: Wed, 16 May 2018 12:55:12 -0600 Subject: [PATCH] Align header parsing to ABP (#3724) --- src/js/storage.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/storage.js b/src/js/storage.js index 78ddeb575..f05a99052 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -755,7 +755,7 @@ // https://github.com/gorhill/uBlock/issues/313 // Always try to fetch the name if this is an external filter list. if ( listEntry.title === '' || listEntry.group === 'custom' ) { - matches = head.match(/(?:^|\n)(?:!|# )[\t ]*Title:([^\n]+)/i); + matches = head.match(/(?:^|\n)(?:!|# )[\t ]*Title[\t ]*:([^\n]+)/i); if ( matches !== null ) { // https://bugs.chromium.org/p/v8/issues/detail?id=2869 // JSON.stringify/JSON.parse is to work around String.slice() @@ -765,10 +765,10 @@ } } // Extract update frequency information - matches = head.match(/(?:^|\n)(?:!|# )[\t ]*Expires:[\t ]*(\d+)[\t ]*(day|hour)/i); + matches = head.match(/(?:^|\n)(?:!|# )[\t ]*Expires[\t ]*:[\t ]*(\d+)[\t ]*(h)?/i); if ( matches !== null ) { v = Math.max(parseInt(matches[1], 10), 1); - if ( matches[2].toLowerCase() === 'hour' ) { + if ( matches[2] !== undefined ) { v = Math.ceil(v / 24); } if ( v !== listEntry.updateAfter ) {