Detect the file type of the logo image instead of the extension

The logo image name is always 'logo-img' no matter the format and
thus never ends in .svg even if it is an SVG file.

Fixes: commit 8dfc4111
parent 8ca5bf55
......@@ -10,6 +10,10 @@
import os
import sys
import magic
typedb = magic.open(magic.MAGIC_MIME_TYPE)
typedb.load()
default_size = (100,100)
......@@ -37,7 +41,7 @@ def process_image():
img.save(head, 'PNG')
try:
if logo.endswith('.svg'):
if typedb.file(logo) in ('image/svg', 'image/svg+xml'):
process_svg()
else:
process_image()
......@@ -45,3 +49,5 @@ except (ImportError, IOError):
remove(head)
if os.path.exists(logo):
symlink(logo, head)
typedb.close()
......@@ -243,6 +243,7 @@ python3-apt
python3-debian
python3-pil
python3-cairosvg
python3-magic
This package is only needed for the download of favicons, which are not
currently used by the census:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment