From 1d52e2df15a30c2d4df4482d18688a408ce32228 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 16 May 2015 13:57:45 +0100 Subject: 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. --- background_scripts/completion.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3