From d9377b550ed23ce9aebcbba465c9f7bb92627386 Mon Sep 17 00:00:00 2001 From: chenpei Date: Fri, 28 Aug 2026 14:52:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=A1=86=E6=94=B9=E7=94=A8=E6=BA=90=E6=9D=A1=E7=9B=AE=E5=8F=A3?= =?UTF-8?q?=E5=BE=84=E6=98=BE=E7=A4=BA=EF=BC=8C=E6=8F=90=E4=BA=A4=E4=B8=8D?= =?UTF-8?q?=E5=B8=A6=E6=89=A9=E5=B1=95=E5=90=8D=E7=94=B1=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AB=AF=E4=BF=9D=E7=95=99=E5=8E=9F=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/share/[id]/page.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/share/[id]/page.tsx b/app/share/[id]/page.tsx index d5692173..730f70dc 100644 --- a/app/share/[id]/page.tsx +++ b/app/share/[id]/page.tsx @@ -989,15 +989,16 @@ export default function SharePage() { const openTaskDetailRenameDialog = (asset: { id: string; fileName?: string }) => { const currentName = asset.fileName || '' - const dotIndex = currentName.lastIndexOf('.') - const baseName = dotIndex > 0 ? currentName.slice(0, dotIndex) : currentName - const extension = dotIndex > 0 ? currentName.slice(dotIndex) : '' + // 预览行文件名不是包内条目名:剥掉 .webp 与历史「源名-preview」尾巴, + // 扩展名由服务端按包内条目自动保留,前端不预设(预设 .webp 会误触扩展名校验)。 + let displayBase = currentName.replace(/\.webp$/i, '') + displayBase = displayBase.replace(/-preview$/i, '') setRenameDialogState({ assetId: asset.id, currentName, - baseName, - extension, - value: baseName, + baseName: displayBase, + extension: '', + value: displayBase, error: null, saving: false, }) @@ -1023,7 +1024,7 @@ export default function SharePage() { assetId: renameDialogState.assetId, kind: 'rename', label: `重命名为 ${nextBaseName}${renameDialogState.extension}`, - newFileName: nextBaseName + renameDialogState.extension, + newFileName: nextBaseName, }) showToast('重命名已加入待应用清单', { variant: 'success' }) setRenameDialogState(null) @@ -1853,7 +1854,7 @@ export default function SharePage() { aria-label="新文件名" /> - {renameDialogState.extension || '(无扩展名)'} + 保存后自动沿用原扩展名 {renameDialogState.error && (