remove non images early (#1007)

This commit is contained in:
Alex Xu
2025-07-02 10:17:54 -07:00
committed by GitHub
parent 6f960aa1d0
commit f41d5327e0
2 changed files with 16 additions and 12 deletions
-6
View File
@@ -48,12 +48,6 @@ class HTMLStripper(HTMLParser):
def getImageFileName(imgfile):
name, ext = os.path.splitext(imgfile)
ext = ext.lower()
if (name.startswith('.') and len(name) == 1):
return None
if name.startswith('._'):
return None
if ext not in ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.jp2', '.j2k', '.jpx']:
return None
return [name, ext]