mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 03:51:08 +00:00
Merge pull request #1193 from bookwyrm-social/cover-images
Safer cover image naming
This commit is contained in:
commit
2f279bbbd4
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