Skip to content

Commit db05081

Browse files
committed
commands: fix _checkUrl
1 parent 0131cd0 commit db05081

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

plugins/Web/test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ def testNonSnarfingRegexpConfigurable(self):
179179
def testFetchIri(self):
180180
self.assertRegexp('fetch http://café.example.org/',
181181
'Error: .*is not a valid')
182+
self.assertRegexp('fetch http://example.org/café',
183+
'Error: .*is not a valid')
182184

183185

184186
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

src/commands.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -667,15 +667,15 @@ def getGlob(irc, msg, args, state):
667667
glob = '*%s*' % glob
668668
state.args.append(glob)
669669

670-
def _checkUrl(url):
670+
def _checkUrl(state, url):
671671
try:
672-
args[0].encode('ascii')
672+
url.encode('ascii')
673673
except UnicodeEncodeError:
674-
state.errorInvalid(_('url'), args[0])
674+
state.errorInvalid(_('url'), url)
675675

676676
def getUrl(irc, msg, args, state):
677677
if utils.web.urlRe.match(args[0]):
678-
_checkUrl(args[0])
678+
_checkUrl(state, args[0])
679679
state.args.append(args.pop(0))
680680
else:
681681
state.errorInvalid(_('url'), args[0])
@@ -694,10 +694,10 @@ def getEmail(irc, msg, args, state):
694694

695695
def getHttpUrl(irc, msg, args, state):
696696
if utils.web.httpUrlRe.match(args[0]):
697-
_checkUrl(args[0])
697+
_checkUrl(state, args[0])
698698
state.args.append(args.pop(0))
699699
elif utils.web.httpUrlRe.match('http://' + args[0]):
700-
_checkUrl('http://' + args[0])
700+
_checkUrl(state, 'http://' + args[0])
701701
state.args.append('http://' + args.pop(0))
702702
else:
703703
state.errorInvalid(_('http url'), args[0])

0 commit comments

Comments
 (0)