mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Make image upload mimetype to match frontend (#98411)
This commit is contained in:
parent
ed18c6a013
commit
a87878f723
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user