mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
The snarfer wasn't quite fixed. Should be fixed for good this time. Also added
a test to make sure that a bad url isn't snarfed.
This commit is contained in:
parent
d55f5c489f
commit
89e5a4aa0e
@ -246,7 +246,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
_sfTitle = re.compile(r'Detail:(\d+) - ([^<]+)</title>', re.I)
|
_sfTitle = re.compile(r'Detail:(\d+) - ([^<]+)</title>', re.I)
|
||||||
_linkType = re.compile(r'(\w+ \w+|\w+): Tracker Detailed View', re.I)
|
_linkType = re.compile(r'(\w+ \w+|\w+): Tracker Detailed View', re.I)
|
||||||
def sfSnarfer(self, irc, msg, match):
|
def sfSnarfer(self, irc, msg, match):
|
||||||
r"https?://(?:www\.)?(?:sourceforge|sf)\.net/tracker/(?:index\.php)?\?(?:&?func=detail|&?aid=\d+|&?group_id=\d+|&?atid=\d+)+"
|
r"https?://(?:www\.)?(?:sourceforge|sf)\.net/tracker/(?:index\.php)?\?(?:&?func=detail|&?aid=\d+|&?group_id=\d+|&?atid=\d+){4}"
|
||||||
if not self.snarfer:
|
if not self.snarfer:
|
||||||
return
|
return
|
||||||
url = match.group(0)
|
url = match.group(0)
|
||||||
|
@ -79,6 +79,8 @@ class SourceforgeTest(PluginTestCase, PluginDocumentation):
|
|||||||
# test that it works
|
# test that it works
|
||||||
self.assertNotError('https://sourceforge.net/tracker/?'
|
self.assertNotError('https://sourceforge.net/tracker/?'
|
||||||
'func=detail&atid=105470&aid=827260&group_id=5470')
|
'func=detail&atid=105470&aid=827260&group_id=5470')
|
||||||
|
self.assertNoResponse('https://sourceforge.net/tracker/?'\
|
||||||
|
'group_id=58965&atid=489447')
|
||||||
|
|
||||||
def testDisablesfsnarfer(self):
|
def testDisablesfsnarfer(self):
|
||||||
self.assertRegexp('http://sourceforge.net/tracker/index.php?'\
|
self.assertRegexp('http://sourceforge.net/tracker/index.php?'\
|
||||||
|
Loading…
Reference in New Issue
Block a user