app接线: 上传去重响应/已存附件删除/缩略图白名单对齐后端 (tsk_sTHRFtFoHf-G)
- createTask 消费后端去重后的权威 attachments 列表,按入库数报数并提示去重数
- 附件删除 toast 语义由 warn 调整为 ok(attDeleted 为成功语义)
- TaskDetail 缩略图 isImg 收敛到 KIT_ATT_SAFE_INLINE 硬白名单(png/jpeg/gif/webp),
与后端 src/api/server.ts SAFE_INLINE 一字不差,svg/html 不走 <img src=服务端URL> inline,
钉死同源存储型 XSS
- i18n 新增 attUploaded/attDeduped 两个带 {n} 占位的 key,覆盖 zh/en/es/ja/fr
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+8
-3
@@ -350,8 +350,13 @@ export function App() {
|
||||
try {
|
||||
const task = await api.createTask(currentId, body);
|
||||
if (files && files.length) {
|
||||
try { await api.uploadAttachments(task.id, files); toast('ok', `附件已上传 · ${files.length} 个`); }
|
||||
catch (e) { toast('warn', e.message); }
|
||||
try {
|
||||
// 消费后端去重后的权威列表:新建任务原本无附件,stored 即本批去重后入库条数
|
||||
const { attachments } = await api.uploadAttachments(task.id, files);
|
||||
const stored = attachments.length;
|
||||
const deduped = files.length - stored; // >0 表示有同内容文件被去重
|
||||
toast('ok', t.attUploaded.replace('{n}', stored) + (deduped > 0 ? t.attDeduped.replace('{n}', deduped) : ''));
|
||||
} catch (e) { toast('warn', e.message); }
|
||||
}
|
||||
toast('ok', t.toastCreated);
|
||||
loadProject(currentId); loadGlobal();
|
||||
@@ -389,7 +394,7 @@ export function App() {
|
||||
},
|
||||
// 删除已建任务的单个附件(name = 磁盘文件名 basename(att.path)),成功后局部刷新
|
||||
delAttachment: async (taskId, name) => {
|
||||
try { await api.deleteAttachment(taskId, name); toast('warn', t.attDeleted); loadProject(currentId); }
|
||||
try { await api.deleteAttachment(taskId, name); toast('ok', t.attDeleted); loadProject(currentId); }
|
||||
catch (e) { toast('warn', t.attDeleteFailed + e.message); }
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user