Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
Merge tag 'v3.7.2' into develop
Browse files Browse the repository at this point in the history
   v3.7.2
  • Loading branch information
AlexandreJunod committed Jun 3, 2024
2 parents ec4d04d + d0a1527 commit 72ead94
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion geocity/apps/api/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from io import BytesIO

from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.db.models import Q
from django.utils.text import get_valid_filename
from PIL import Image
Expand All @@ -22,7 +23,11 @@ def get_mime_type(content):
"""
Used to retrieve mime type in response.content of request
"""
image = Image.open(BytesIO(content))
try:
image = Image.open(BytesIO(content))
except:
raise SuspiciousOperation

image_format = image.format
mime_type = "image/" + image_format.lower()
return mime_type
Expand Down

0 comments on commit 72ead94

Please sign in to comment.