Google: Decode URLs. Closes GH-1260.

This commit is contained in:
Valentin Lorentz 2016-08-10 22:52:00 +02:00
parent 866d95ca0b
commit fa755c3a9c
2 changed files with 7 additions and 1 deletions

View File

@ -82,7 +82,7 @@ class Google(callbacks.PluginRegexp):
results = [] results = []
for match in matches: for match in matches:
r = dict(zip(('url', 'title', 'cacheUrl', 'content'), match)) r = dict(zip(('url', 'title', 'cacheUrl', 'content'), match))
r['url'] = utils.web.htmlToText(r['url'].split('&')[0]) r['url'] = utils.web.urlunquote(utils.web.htmlToText(r['url'].split('&')[0]))
results.append(r) results.append(r)
return results return results

View File

@ -54,6 +54,12 @@ class GoogleTestCase(ChannelPluginTestCase):
# Unicode check # Unicode check
self.assertNotError('google ae') self.assertNotError('google ae')
def testUrlDecode(self):
self.assertRegexp(
'google site:http://www.urbandictionary.com carajo land',
'\x02Urban Dictionary: carajo land\x02: '
'https?://www.urbandictionary.com/define.php\?term=carajo%20land')
def testLucky(self): def testLucky(self):
self.assertResponse('lucky Hacker News', self.assertResponse('lucky Hacker News',
'https://news.ycombinator.com/') 'https://news.ycombinator.com/')