From a8fe715eee7c2c136508760758f937e36d71e023 Mon Sep 17 00:00:00 2001 From: Patrick Kettner Date: Tue, 7 Dec 2021 18:42:54 -0500 Subject: [PATCH] `path` is not always a string, ensure it isn\'t false-y before accessing it --- src/helpers/AmpConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/AmpConfig.js b/src/helpers/AmpConfig.js index 3b572e1..a3eb25d 100644 --- a/src/helpers/AmpConfig.js +++ b/src/helpers/AmpConfig.js @@ -30,7 +30,7 @@ const AmpConfig = (providedOptions) => { throw new Error(`filter needs to be a valid RegExp, provided : ${options.filter}`); } - options.isAmp = (path) => path.endsWith('.html') && options.filter.test(path); + options.isAmp = (path) => path && path.endsWith('.html') && options.filter.test(path); if (providedOptions.optimizeImages !== false && !providedOptions.imageOptimizer) { options.imageOptimizer = ImageOptimizer.create(options);