From 1ca4a4d185fff72c3b192db4fcb3e96c04e59ce2 Mon Sep 17 00:00:00 2001 From: wangziqi Date: Fri, 10 Jul 2026 14:11:47 +0800 Subject: [PATCH] fix(archive): serve student attachments securely Download attachments through authenticated API requests, support configurable upload paths, validate resolved file locations, and retain compatibility with legacy stored paths. --- .../StudentProfileContent/index.tsx | 17 ++++++-- apps/server/src/archive/archive.controller.ts | 21 +++++++++- apps/server/src/archive/archive.service.ts | 39 +++++++++++++++++-- 3 files changed, 68 insertions(+), 9 deletions(-) diff --git a/apps/admin/src/components/StudentProfileContent/index.tsx b/apps/admin/src/components/StudentProfileContent/index.tsx index a3b6c76..13de633 100644 --- a/apps/admin/src/components/StudentProfileContent/index.tsx +++ b/apps/admin/src/components/StudentProfileContent/index.tsx @@ -630,7 +630,7 @@ const AttachmentsTab: React.FC = ({ dat const handleDelete = async (attachmentId: number) => { try { - await api.delete(`/archive/${studentId}/attachments/${attachmentId}`); + await api.delete(`/archive/attachments/${attachmentId}`); message.success('已删除'); onRefresh(); } catch (e: unknown) { @@ -654,9 +654,18 @@ const AttachmentsTab: React.FC = ({ dat