extensions-website/files/apps.py
Anna Sirota 1f07de4ea9 Files: add WebP MIME-type
Ubuntu 22.04 and earlier don't have WebP in `/etc/mime.types`,
which makes .webp invalid from the point of view of file upload forms.
This should ensure that WebP can actually be uploaded regardless of distro
the app is running on.
2024-04-26 13:34:30 +02:00

17 lines
529 B
Python

from django.apps import AppConfig
class FilesConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'files'
def ready(self):
import files.signals # noqa: F401
# Ubuntu 22.04 and earlier don't have WebP in `/etc/mime.types`,
# which makes .webp invalid from standpoint of file upload forms.
# FIXME: remove once the application is running on the next Ubuntu 24.04 LTS
import mimetypes
mimetypes.add_type('image/webp', '.webp', strict=True)