fix: handle case where mimetype is None (#26131)

This commit is contained in:
Raffael Meyer 2024-04-23 16:24:49 +02:00 committed by GitHub
parent 79d18c1fbb
commit 2ec9ef5bf3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -276,7 +276,7 @@ def _get_base64_image(src):
path = parsed_url.path
query = parse_qs(parsed_url.query)
mime_type = mimetypes.guess_type(path)[0]
if not mime_type.startswith("image/"):
if mime_type is None or not mime_type.startswith("image/"):
return
filename = query.get("fid") and query["fid"][0] or None
file = find_file_by_url(path, name=filename)