Improve raised exception consistency for media source (#66497)

This commit is contained in:
Paulus Schoutsen 2022-02-14 06:41:53 -08:00 committed by GitHub
parent 80394e3de6
commit 707f112f51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 6 deletions

View file

@ -276,7 +276,7 @@ class UploadMediaView(HomeAssistantView):
uploaded_file: FileField = data["file"]
if not uploaded_file.content_type.startswith(("image/", "video/")):
if not uploaded_file.content_type.startswith(("image/", "video/", "audio/")):
LOGGER.error("Content type not allowed")
raise vol.Invalid("Only images and video are allowed")