From 18a5f41a04cc6108034d13ec342a77a57b4bc2f1 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 6 Jul 2020 08:31:53 -0400 Subject: [PATCH] Better processing of `Expires` directive in filter list In case of invalid `Expires` value -- i.e. `NaN` -- do not use `1` as default value, just let uBO pick the value according to the global default (which is `5` as of commit time). --- src/js/storage.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/js/storage.js b/src/js/storage.js index 0ae3ccb2b..2bafe60de 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -760,12 +760,15 @@ self.addEventListener('hiddenSettingsChanged', ( ) => { // Extract update frequency information const matches = head.match(/(?:^|\n)(?:!|# )[\t ]*Expires[\t ]*:[\t ]*(\d+)[\t ]*(h)?/i); if ( matches !== null ) { - let v = Math.max(parseInt(matches[1], 10), 1); - if ( matches[2] !== undefined ) { - v = Math.ceil(v / 24); - } - if ( v !== listEntry.updateAfter ) { - this.assets.registerAssetSource(assetKey, { updateAfter: v }); + let v = parseInt(matches[1], 10); + if ( isNaN(v) === false ) { + if ( matches[2] !== undefined ) { + v = Math.ceil(v / 24); + } + v = Math.max(v, 1); + if ( v !== listEntry.updateAfter ) { + this.assets.registerAssetSource(assetKey, { updateAfter: v }); + } } } };