django-cms / django-filer

File and Image Management Application for django
https://django-filer.readthedocs.io/
Other
1.73k stars 575 forks source link

SVGs do not render #1271

Closed SkWiirrel closed 2 years ago

SkWiirrel commented 2 years ago

Uploading SVGs work but they do not render at all both in the admin backend and when trying to render them in templates for example like {{ icon.url }} or {% thumbnail icon 32x32 crop %}. Entering the actual media URL directly in the browser works and the SVG can be downloaded.

Admin_Filer

I have gone through the logs and they say something about Failed lookup for key [sidebar_image_ratio]:

################### [09/Jan/2022 09:30:27] DEBUG [django.template:873] Exception while resolving variable 'sidebar_image_ratio' in template 'admin/filer/widgets/admin_file.html'. Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 829, in _resolve_lookup current = current[bit] File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/context.py", line 83, in getitem raise KeyError(key) KeyError: 'sidebar_image_ratio'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 835, in _resolve_lookup if isinstance(current, BaseContext) and getattr(type(current), bit): AttributeError: type object 'Context' has no attribute 'sidebar_image_ratio'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 843, in _resolve_lookup current = current[int(bit)] ValueError: invalid literal for int() with base 10: 'sidebar_image_ratio'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 850, in _resolve_lookup (bit, current)) # missing attribute django.template.base.VariableDoesNotExist: Failed lookup for key [sidebar_image_ratio] in [{'True': True, 'False': False, 'None': None}, {'mime_maintype': 'image', 'mime_type': 'image/svg+xml', 'alt_text': None, 'width': 80, 'height': 80, 'icon_url': '/media/filer_public_thumbnails/filer_public/51/fa/51fa7f7f-66ae-4bd0-9909-7c392385797a/flag_of_vienna_state.svg__80x80_crop.svg'}] [09/Jan/2022 09:30:27] DEBUG [django.template:873] Exception while resolving variable 'download_url' in template 'admin/filer/widgets/admin_file.html'. Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 829, in _resolve_lookup current = current[bit] File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/context.py", line 83, in getitem raise KeyError(key) KeyError: 'download_url'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 835, in _resolve_lookup if isinstance(current, BaseContext) and getattr(type(current), bit): AttributeError: type object 'Context' has no attribute 'download_url'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 843, in _resolve_lookup current = current[int(bit)] ValueError: invalid literal for int() with base 10: 'download_url'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 850, in _resolve_lookup (bit, current)) # missing attribute django.template.base.VariableDoesNotExist: Failed lookup for key [download_url] in [{'True': True, 'False': False, 'None': None}, {'mime_maintype': 'image', 'mime_type': 'image/svg+xml', 'alt_text': None, 'width': 80, 'height': 80, 'icon_url': '/media/filer_public_thumbnails/filer_public/51/fa/51fa7f7f-66ae-4bd0-9909-7c392385797a/flag_of_vienna_state.svg__80x80_crop.svg'}] [09/Jan/2022 09:30:27] DEBUG [django.template:873] Exception while resolving variable 'highres_url' in template 'admin/filer/widgets/admin_file.html'. Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 829, in _resolve_lookup current = current[bit] File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/context.py", line 83, in getitem raise KeyError(key) KeyError: 'highres_url'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 835, in _resolve_lookup if isinstance(current, BaseContext) and getattr(type(current), bit): AttributeError: type object 'Context' has no attribute 'highres_url'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 843, in _resolve_lookup current = current[int(bit)] ValueError: invalid literal for int() with base 10: 'highres_url'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 850, in _resolve_lookup (bit, current)) # missing attribute django.template.base.VariableDoesNotExist: Failed lookup for key [highres_url] in [{'True': True, 'False': False, 'None': None}, {'mime_maintype': 'image', 'mime_type': 'image/svg+xml', 'alt_text': None, 'width': 80, 'height': 80, 'icon_url': '/media/filer_public_thumbnails/filer_public/51/fa/51fa7f7f-66ae-4bd0-9909-7c392385797a/flag_of_vienna_state.svg80x80_crop.svg'}] [09/Jan/2022 09:30:27] DEBUG [django.template:873] Exception while resolving variable 'sidebar_image_ratio' in template 'admin/filer/widgets/admin_file.html'. Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 829, in _resolve_lookup current = current[bit] File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/context.py", line 83, in getitem__ raise KeyError(key) KeyError: 'sidebar_image_ratio'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 835, in _resolve_lookup if isinstance(current, BaseContext) and getattr(type(current), bit): AttributeError: type object 'Context' has no attribute 'sidebar_image_ratio'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 843, in _resolve_lookup current = current[int(bit)] ValueError: invalid literal for int() with base 10: 'sidebar_image_ratio'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/srv/python-virt-env/smashbrothers-dev/lib64/python3.6/site-packages/django/template/base.py", line 850, in _resolve_lookup (bit, current)) # missing attribute django.template.base.VariableDoesNotExist: Failed lookup for key [sidebar_image_ratio] in [{'True': True, 'False': False, 'None': None}, {'mime_maintype': 'image', 'mime_type': 'image/svg+xml', 'alt_text': None, 'width': 80, 'height': 80, 'icon_url': '/media/filer_public_thumbnails/filer_public/51/fa/51fa7f7f-66ae-4bd0-9909-7c392385797a/flag_of_vienna_state.svg__80x80_crop.svg'}] ###################

Here is the requirements.txt.

SkWiirrel commented 2 years ago

It was actually an issue with the mime-type coming from the server (nginx).