From e45127b404ce194e389b447b68a33957ad9f3492 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 8 Sep 2021 21:34:00 +0200 Subject: wildcard_domains: Change wildcard character to '%' The '*' character is not ideal to use in filenames because if you forget to escape it in the shell, it can have harmful consequences. --- background.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/background.js b/background.js index beee8e0..5bde79a 100644 --- a/background.js +++ b/background.js @@ -38,13 +38,12 @@ browser.runtime.onMessage.addListener(function(message) { }); -// TODO: Consider choosing a different wildcard character, as '*' is troublesome in a shell (maybe '%') // Build a list of wildcard domains from the given hostname. // // Example: // // wildcard_domains('en.wikipedia.org'); -// => [ '*', '*.org', '*.wikipedia.org', 'en.wikipedia.org' ] +// => [ '%', '%.org', '%.wikipedia.org', 'en.wikipedia.org' ] function wildcard_domains (hostname) { var domain_parts = hostname.split('.'); var domains = []; @@ -63,10 +62,10 @@ function wildcard_domains (hostname) { } for (var i = 0; i < domains.length - 1; i++) { - domains[i] = '*.' + domains[i]; + domains[i] = '%.' + domains[i]; } - domains.unshift('*'); + domains.unshift('%'); return domains; } -- cgit v1.2.3