mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Catch a webutils.WebError, fix whitespace, and remove a urlquote
This commit is contained in:
parent
6a1b9ccaeb
commit
b4580384ee
@ -139,11 +139,14 @@ class ShrinkUrl(callbacks.PrivmsgCommandAndRegexp):
|
||||
url = m.group(1)
|
||||
if len(url) > self.registryValue('minimumLength', channel):
|
||||
cmd = self.registryValue('default', channel)
|
||||
try:
|
||||
if cmd == 'ln':
|
||||
(shortUrl, _) = self._getLnUrl(url)
|
||||
elif cmd == 'tiny':
|
||||
shortUrl = self._getTinyUrl(url)
|
||||
text = text.replace(url, shortUrl)
|
||||
except webutils.WebError:
|
||||
pass
|
||||
newMsg = ircmsgs.privmsg(channel, text, msg=msg)
|
||||
newMsg.tag('shrunken')
|
||||
irc.queueMsg(newMsg)
|
||||
@ -192,7 +195,6 @@ class ShrinkUrl(callbacks.PrivmsgCommandAndRegexp):
|
||||
try:
|
||||
return self.db.getLn(url)
|
||||
except KeyError:
|
||||
url = webutils.urlquote(url)
|
||||
text = webutils.getUrl('http://ln-s.net/home/api.jsp?url=%s' % url)
|
||||
(code, lnurl) = text.split(None, 1)
|
||||
lnurl = lnurl.strip()
|
||||
|
Loading…
Reference in New Issue
Block a user