forked from mirrors/bookwyrm
Safer cover image naming
This commit is contained in:
parent
e03b8ef2cd
commit
4a5e4e8ca2
1 changed files with 2 additions and 1 deletions
|
@ -408,7 +408,8 @@ class ImageField(ActivitypubFieldMixin, models.ImageField):
|
|||
return None
|
||||
|
||||
image_content = ContentFile(response.content)
|
||||
image_name = str(uuid4()) + "." + imghdr.what(None, image_content.read())
|
||||
extension = imghdr.what(None, image_content.read()) or ""
|
||||
image_name = "{:s}.{:s}".format(str(uuid4()), extension)
|
||||
return [image_name, image_content]
|
||||
|
||||
def formfield(self, **kwargs):
|
||||
|
|
Loading…
Reference in a new issue