aboutsummaryrefslogtreecommitdiffstats
path: root/pages
diff options
context:
space:
mode:
authorStephen Blott2018-02-24 07:37:02 +0000
committerStephen Blott2018-02-24 07:37:55 +0000
commit17425d7187a96f8f7cdd15723f21220733e64c78 (patch)
tree775be2452937d2422b989196d69ab3f2ae505cfb /pages
parentbef8788805bc3e09de432f8642b54fccf3591947 (diff)
downloadvimium-17425d7187a96f8f7cdd15723f21220733e64c78.tar.bz2
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.
Diffstat (limited to 'pages')
-rw-r--r--pages/options.coffee4
1 files changed, 3 insertions, 1 deletions
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("/") + "/*"