fix traceback preventing showing ALT text of an image. Fixes #5247
This commit is contained in:
parent
4db1d2738c
commit
70e145a827
1 changed files with 33 additions and 34 deletions
|
@ -483,6 +483,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
def _process_img(self, attrs):
|
def _process_img(self, attrs):
|
||||||
'''Process a img tag.
|
'''Process a img tag.
|
||||||
'''
|
'''
|
||||||
|
mem = ''
|
||||||
try:
|
try:
|
||||||
# Wait maximum 1s for connection
|
# Wait maximum 1s for connection
|
||||||
socket.setdefaulttimeout(1)
|
socket.setdefaulttimeout(1)
|
||||||
|
@ -499,7 +500,6 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
# Max image size = 2 MB (to try to prevent DoS)
|
# Max image size = 2 MB (to try to prevent DoS)
|
||||||
mem = ''
|
|
||||||
deadline = time.time() + 3
|
deadline = time.time() + 3
|
||||||
while True:
|
while True:
|
||||||
if time.time() > deadline:
|
if time.time() > deadline:
|
||||||
|
@ -516,7 +516,6 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
except socket.timeout, ex:
|
except socket.timeout, ex:
|
||||||
gajim.log.debug('Timeout loading image %s ' % attrs['src'] + \
|
gajim.log.debug('Timeout loading image %s ' % attrs['src'] + \
|
||||||
str(ex))
|
str(ex))
|
||||||
mem = ''
|
|
||||||
alt = attrs.get('alt', '')
|
alt = attrs.get('alt', '')
|
||||||
if alt:
|
if alt:
|
||||||
alt += '\n'
|
alt += '\n'
|
||||||
|
|
Loading…
Add table
Reference in a new issue