From f0574da59ad93f7b80a5f63295aa57adaf7b4cd4 Mon Sep 17 00:00:00 2001 From: Daniel DiPaolo Date: Fri, 24 Oct 2003 00:46:21 +0000 Subject: [PATCH] Fixed the 'title' regexp to be non-greedy, in case there's a tag within the document itself. Also put a test for this (which will hopefully be a permanent link... not sure though) --- plugins/Http.py | 2 +- test/test_Http.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/Http.py b/plugins/Http.py index 151c4ab3d..6a54e8e00 100644 --- a/plugins/Http.py +++ b/plugins/Http.py @@ -79,7 +79,7 @@ class FreshmeatException(Exception): class Http(callbacks.Privmsg): threaded = True - _titleRe = re.compile(r'(.*)', re.I | re.S) + _titleRe = re.compile(r'(.*?)', re.I | re.S) def title(self, irc, msg, args): """ diff --git a/test/test_Http.py b/test/test_Http.py index 2b5b84126..6b4571629 100644 --- a/test/test_Http.py +++ b/test/test_Http.py @@ -49,6 +49,11 @@ class HttpTest(PluginTestCase, PluginDocumentation): '1884822312/qid=1063140754/sr=8-1/ref=sr_8_1/' '002-9802970-2308826?v=glance&s=books&n=507846', '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): self.assertNotError('geekquote')