Generic camera: Allow svg detect to accept leading whitespace (#68932)

This commit is contained in:
Dave T 2022-03-30 23:45:55 +01:00 committed by GitHub
parent d25f7e1376
commit 3244980a35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -114,7 +114,7 @@ def get_image_type(image):
if fmt is None:
# if imghdr can't figure it out, could be svg.
with contextlib.suppress(UnicodeDecodeError):
if image.decode("utf-8").startswith("<svg"):
if image.decode("utf-8").lstrip().startswith("<svg"):
return "svg+xml"
return fmt