Skip to content

Commit

Permalink
Merge pull request #107 from ampproject/nullcheck
Browse files Browse the repository at this point in the history
`path` is not always a string, ensure  it isn\'t false-y before accessing it
  • Loading branch information
sebastianbenz authored Dec 8, 2021
2 parents b4c4d96 + a8fe715 commit 4bca29b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/helpers/AmpConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4bca29b

Please sign in to comment.