From 7d35b642fdc288217f1c674de819186b8cc31445 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Tue, 30 Apr 2019 19:37:32 -0500 Subject: [PATCH] Fix replace_failed_smilies_with_alt_text for XF2. --- fanficfare/adapters/base_xenforoforum_adapter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fanficfare/adapters/base_xenforoforum_adapter.py b/fanficfare/adapters/base_xenforoforum_adapter.py index 7abe0032..4b1a778a 100644 --- a/fanficfare/adapters/base_xenforoforum_adapter.py +++ b/fanficfare/adapters/base_xenforoforum_adapter.py @@ -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'