From 96233ee9b2b59c581dd0c47b707366c452733348 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:02:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E6=8B=96=E5=8A=A8?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E5=A4=B9=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20(#3983)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/host/file-management/upload/index.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/host/file-management/upload/index.vue b/frontend/src/views/host/file-management/upload/index.vue index f9ccdf7d7..8d62e163d 100644 --- a/frontend/src/views/host/file-management/upload/index.vue +++ b/frontend/src/views/host/file-management/upload/index.vue @@ -301,7 +301,7 @@ const submit = async () => { const chunk = file.raw.slice(start, end); const formData = new FormData(); - formData.append('filename', file.name); + formData.append('filename', getFilenameFromPath(file.name)); if (file.raw.webkitRelativePath != '') { formData.append('path', path.value + '/' + getPathWithoutFilename(file.raw.webkitRelativePath)); } else { @@ -350,6 +350,10 @@ const getPathWithoutFilename = (path: string) => { return path ? path.split('/').slice(0, -1).join('/') : path; }; +const getFilenameFromPath = (path) => { + return path ? path.split('/').pop() : path; +}; + const acceptParams = (props: UploadFileProps) => { path.value = props.path; open.value = true;