Merge branch 'main' of gitlab.com:bashrc2/epicyon

merge-requests/30/head
Bob Mottram 2021-12-19 12:39:22 +00:00
commit 6e312bba72
1 changed files with 7 additions and 0 deletions

View File

@ -18,6 +18,7 @@ from datetime import timezone
from collections import OrderedDict
from utils import validPostDate
from categories import setHashtagCategory
from utils import dangerousSVG
from utils import getFavFilenameFromUrl
from utils import getBaseContentFromPost
from utils import hasObjectDict
@ -176,6 +177,11 @@ def _downloadNewswireFeedFavicon(session, baseDir: str,
if not os.path.isdir(baseDir + '/favicons'):
os.mkdir(baseDir + '/favicons')
# check svg for dubious scripts
if favUrl.endswith('.svg'):
if dangerousSVG(str(imageData), False):
return False
# save to the cache
favFilename = getFavFilenameFromUrl(baseDir, favUrl)
if os.path.isfile(favFilename):
@ -186,6 +192,7 @@ def _downloadNewswireFeedFavicon(session, baseDir: str,
except OSError:
print('EX: failed writing favicon ' + favFilename)
return False
return True