From ed4c65600c9ebddc7c4369cdda43a8018fb3043c Mon Sep 17 00:00:00 2001 From: thomas girod Date: Fri, 13 Sep 2024 18:05:42 +0200 Subject: [PATCH] fix image extension --- sas/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sas/models.py b/sas/models.py index 0c0efb5f..4566feac 100644 --- a/sas/models.py +++ b/sas/models.py @@ -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