aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/completion.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-05-16 13:57:45 +0100
committerStephen Blott2015-05-16 13:57:48 +0100
commit1d52e2df15a30c2d4df4482d18688a408ce32228 (patch)
tree8008ee4f411ac89c0a0c8302f378c405d9f920ec /background_scripts/completion.coffee
parentfdb41edfeb763cc4805e640ced7a576b7bebe02f (diff)
downloadvimium-1d52e2df15a30c2d4df4482d18688a408ce32228.tar.bz2
Apply decodeURI when shortening URLs.
If the URL contains a query term such as vierwaldstättersee, then we render the URL encoded version in the vomnibar. It looks considerably nicer to render URL-decoded version.
Diffstat (limited to 'background_scripts/completion.coffee')
-rw-r--r--background_scripts/completion.coffee8
1 files changed, 7 insertions, 1 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee
index ee41aa07..5a47d8db 100644
--- a/background_scripts/completion.coffee
+++ b/background_scripts/completion.coffee
@@ -130,7 +130,13 @@ class Suggestion
# Simplify a suggestion's URL (by removing those parts which aren't useful for display or comparison).
shortenUrl: () ->
return @shortUrl if @shortUrl?
- url = @url
+ # We get easier-to-read shortened URLs if we URI-decode them.
+ url =
+ try
+ # decodeURI can raise an exception.
+ url = decodeURI @url
+ catch
+ @url
for [ filter, replacements ] in @stripPatterns
if new RegExp(filter).test url
for replace in replacements