Catch a webutils.WebError, fix whitespace, and remove a urlquote

This commit is contained in:
James Vega 2004-10-04 18:15:06 +00:00
parent 6a1b9ccaeb
commit b4580384ee
1 changed files with 35 additions and 33 deletions

View File

@ -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()