From a87878f72362529e8c28aa5eef60ff67fc5ec113 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 15 Aug 2023 12:26:37 +0200 Subject: [PATCH] Make image upload mimetype to match frontend (#98411) --- homeassistant/components/image_upload/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/image_upload/__init__.py b/homeassistant/components/image_upload/__init__.py index 569df9c65e4..6486d584b0e 100644 --- a/homeassistant/components/image_upload/__init__.py +++ b/homeassistant/components/image_upload/__init__.py @@ -78,8 +78,10 @@ class ImageStorageCollection(collection.DictStorageCollection): data = self.CREATE_SCHEMA(dict(data)) uploaded_file: FileField = data["file"] - if not uploaded_file.content_type.startswith("image/"): - raise vol.Invalid("Only images are allowed") + if not uploaded_file.content_type.startswith( + ("image/gif", "image/jpeg", "image/png") + ): + raise vol.Invalid("Only jpeg, png, and gif images are allowed") data[CONF_ID] = secrets.token_hex(16) data["filesize"] = await self.hass.async_add_executor_job(self._move_data, data)