mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Fixed the 'title' regexp to be non-greedy, in case there's a </title> tag
within the document itself. Also put a test for this (which will hopefully be a permanent link... not sure though)
This commit is contained in:
parent
aa05fc1a79
commit
f0574da59a
@ -79,7 +79,7 @@ class FreshmeatException(Exception):
|
|||||||
class Http(callbacks.Privmsg):
|
class Http(callbacks.Privmsg):
|
||||||
threaded = True
|
threaded = True
|
||||||
|
|
||||||
_titleRe = re.compile(r'<title>(.*)</title>', re.I | re.S)
|
_titleRe = re.compile(r'<title>(.*?)</title>', re.I | re.S)
|
||||||
def title(self, irc, msg, args):
|
def title(self, irc, msg, args):
|
||||||
"""<url>
|
"""<url>
|
||||||
|
|
||||||
|
@ -49,6 +49,11 @@ class HttpTest(PluginTestCase, PluginDocumentation):
|
|||||||
'1884822312/qid=1063140754/sr=8-1/ref=sr_8_1/'
|
'1884822312/qid=1063140754/sr=8-1/ref=sr_8_1/'
|
||||||
'002-9802970-2308826?v=glance&s=books&n=507846',
|
'002-9802970-2308826?v=glance&s=books&n=507846',
|
||||||
'no HTML title')
|
'no HTML title')
|
||||||
|
# Checks the non-greediness of the regexp
|
||||||
|
self.assertResponse('title '
|
||||||
|
'http://www.space.com/scienceastronomy/'
|
||||||
|
'jupiter_dark_spot_031023.html',
|
||||||
|
'Mystery Spot on Jupiter Baffles Astronomers')
|
||||||
|
|
||||||
def testGeekquote(self):
|
def testGeekquote(self):
|
||||||
self.assertNotError('geekquote')
|
self.assertNotError('geekquote')
|
||||||
|
Loading…
Reference in New Issue
Block a user