Fix replace_failed_smilies_with_alt_text for XF2.

This commit is contained in:
Jim Miller 2019-04-30 19:37:32 -05:00
parent a6ec8fd1d8
commit 7d35b642fd

View file

@ -701,10 +701,10 @@ class BaseXenForoForumAdapter(BaseSiteAdapter):
def _do_utf8FromSoup(self,url,soup,fetch=None,allow_replace_br_with_p=True):
if self.getConfig('replace_failed_smilies_with_alt_text'):
for img in soup.find_all('img',src=re.compile(r'(failedtoload|clear.png)$')):
for img in soup.find_all('img',src=re.compile(r'(^data:image|(failedtoload|clear.png)$)')):
# logger.debug("replace_failed_smilies_with_alt_text img: %s"%img)
clses = unicode(img['class']) # stringify list.
if img.has_attr('alt') and 'mceSmilie' in clses :
if img.has_attr('alt') and ('mceSmilie' in clses or 'smilie--sprite' in clses):
## Change the img to a span containing the alt
## text, remove attrs. This is a one-way change.
img.name='span'