From 17425d7187a96f8f7cdd15723f21220733e64c78 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 24 Feb 2018 07:37:02 +0000 Subject: Escape [ and ] in hostname. From URL: http://[fe80::cce4:1680:e720:eacb]:8080/index.html generate: https?://\[fe80::cce4:1680:e720:eacb\]:8080/* in the popup (note that [ and ] are now escaped). Fixes #2967. --- pages/options.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pages/options.coffee b/pages/options.coffee index 74eedc39..c3e6c3be 100644 --- a/pages/options.coffee +++ b/pages/options.coffee @@ -181,7 +181,9 @@ class ExclusionRulesOnPopupOption extends ExclusionRulesOption if /^https?:\/\/./.test @url # The common use case is to disable Vimium at the domain level. # Generate "https?://www.example.com/*" from "http://www.example.com/path/to/page.html". - "https?:/" + @url.split("/",3)[1..].join("/") + "/*" + # Note: IPV6 host addresses will contain "[" and "]" (which must be escaped). + hostname = @url.split("/",3)[1..].join("/").replace("[", "\\[").replace "]", "\\]" + "https?:/" + hostname + "/*" else if /^[a-z]{3,}:\/\/./.test @url # Anything else which seems to be a URL. @url.split("/",3).join("/") + "/*" -- cgit v1.2.3