Web: Fix exception raised due to lack of Content-Type

This commit is contained in:
Tasos Sahanidis 2017-09-20 03:57:33 +03:00
parent bdbc79bfc6
commit 8dbf37a173
No known key found for this signature in database
GPG Key ID: 01A1DCBA22E005C4

View File

@ -279,6 +279,8 @@ class Web(callbacks.PluginRegexp):
try: try:
try: try:
size = fd.headers['Content-Length'] size = fd.headers['Content-Length']
if size is None:
raise KeyError('content-length')
irc.reply(format(_('%u is %S long.'), url, int(size))) irc.reply(format(_('%u is %S long.'), url, int(size)))
except KeyError: except KeyError:
size = conf.supybot.protocols.http.peekSize() size = conf.supybot.protocols.http.peekSize()