From 2a11891988e928110c19416b548ab73748ce1c4a Mon Sep 17 00:00:00 2001 From: guanj Date: Sun, 4 Jan 2026 09:01:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=88=99=E6=9B=BF=E6=8D=A2[]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system-boot/file.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/api/system-boot/file.ts b/src/api/system-boot/file.ts index 5be9ad94..eae81f1b 100644 --- a/src/api/system-boot/file.ts +++ b/src/api/system-boot/file.ts @@ -7,8 +7,20 @@ const SYSTEM_PREFIX = '/system-boot' * @param file */ export const uploadFile = (file: any, path: string) => { + const regex = /\[|\]/g + // 替换规则:[ 换成 (,] 换成 ) + + const newFile = new File( + [file], // 原文件的二进制内容 + file.name.replace(regex, match => (match === '[' ? '(' : ')')), // 新的文件名 + { + type: file.type, // 复用原文件的MIME类型 + lastModified: file.lastModified // 复用最后修改时间 + } + ) + let form = new FormData() - form.append('file', file) + form.append('file', newFile) form.append('path', path) return createAxios({ url: SYSTEM_PREFIX + '/file/upload',