From 64219a9a243f064bff0da8ba8fc4521454959e22 Mon Sep 17 00:00:00 2001 From: spdis Date: Sat, 15 Nov 2025 17:56:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E4=B8=BAwebp=E5=90=8E=E4=B8=8D=E5=88=A0=E9=99=A4=E6=BA=90?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- elastic/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/elastic/views.py b/elastic/views.py index 427d199..92678f5 100644 --- a/elastic/views.py +++ b/elastic/views.py @@ -430,6 +430,14 @@ def confirm(request): if not ok: return JsonResponse({"status": "error", "message": "写入ES失败"}, status=500) + try: + if image_rel and final_image_rel != image_rel: + orig_abs = os.path.join(settings.MEDIA_ROOT, image_rel) + if os.path.isfile(orig_abs): + os.remove(orig_abs) + except Exception: + pass + return JsonResponse({"status": "success", "message": "数据录入成功", "data": edited})