From 947d1541182463dc82f82789e427afa7f1f919bf Mon Sep 17 00:00:00 2001 From: seaislee1209 Date: Thu, 9 Apr 2026 21:04:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20pollStatus=20=E5=B7=B2=20active=20?= =?UTF-8?q?=E7=9A=84=E7=B4=A0=E6=9D=90=E8=B7=B3=E8=BF=87=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=EF=BC=8C=E9=98=B2=E6=AD=A2=E8=B7=A8=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=B4=A0=E6=9D=90=E8=A2=AB=E8=AF=AF=E5=88=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/apps/generation/views.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/apps/generation/views.py b/backend/apps/generation/views.py index cbe718f..66392bb 100644 --- a/backend/apps/generation/views.py +++ b/backend/apps/generation/views.py @@ -3446,7 +3446,8 @@ def asset_poll_status_view(request, asset_id): except Asset.DoesNotExist: return Response({'error': '素材不存在'}, status=status.HTTP_404_NOT_FOUND) - if asset.remote_asset_id: + # 已经 active 且有 URL 的素材跳过远程查询(避免跨项目素材被误删) + if asset.remote_asset_id and asset.status != 'active': from utils import assets_client from utils.assets_client import AssetsAPIError try: @@ -3463,7 +3464,6 @@ def asset_poll_status_view(request, asset_id): asset.save(update_fields=['status', 'url', 'error_message']) except AssetsAPIError as e: error_str = str(e) - # 火山返回素材不存在 → 删除本地记录 if 'not found' in error_str.lower() or 'NotFound' in e.code or 'NotExist' in e.code: asset.delete() return Response({'status': 'deleted', 'message': '素材在云端已被删除'}) @@ -3473,7 +3473,6 @@ def asset_poll_status_view(request, asset_id): ) except Exception as e: error_str = str(e) - # 空响应 / JSON 解析失败 = 火山已删除该素材 if 'Expecting value' in error_str or 'JSONDecodeError' in type(e).__name__: logger.info('Asset %s appears deleted on remote (empty response), removing local record', asset.remote_asset_id) asset.delete()