Merge pull request #823 from ae-utbm/fix-image-extension

fix image extension
This commit is contained in:
thomas girod 2024-09-14 19:48:30 +02:00 committed by GitHub
commit 8e48103fd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,6 +16,7 @@
from __future__ import annotations
from io import BytesIO
from pathlib import Path
from typing import ClassVar, Self
from django.conf import settings
@ -123,7 +124,7 @@ class Picture(SasFile):
self.file.delete()
self.thumbnail.delete()
self.compressed.delete()
new_extension_name = self.name.removesuffix(extension) + "webp"
new_extension_name = str(Path(self.name).with_suffix(".webp"))
self.file = file
self.file.name = self.name
self.thumbnail = thumb