From 64bc92a7fdaa803217d671955952abccfcda3ed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=98=AD?= <81747598+lan-yonghui@users.noreply.github.com> Date: Tue, 10 Sep 2024 10:14:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=99=90=E5=88=B6=E4=BA=8C=E8=BF=9B?= =?UTF-8?q?=E5=88=B6=E6=96=87=E4=BB=B6=E8=A7=A3=E5=8E=8B=E7=9A=84=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=20(#6425)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs #6113 --- .../src/views/host/file-management/index.vue | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/host/file-management/index.vue b/frontend/src/views/host/file-management/index.vue index 2444f40c1..0cd687f8f 100644 --- a/frontend/src/views/host/file-management/index.vue +++ b/frontend/src/views/host/file-management/index.vue @@ -1097,7 +1097,7 @@ const buttons = [ label: i18n.global.t('file.deCompress'), click: openDeCompress, disabled: (row: File.File) => { - return row.isDir; + return !isDecompressFile(row); }, }, { @@ -1137,6 +1137,20 @@ const buttons = [ }, ]; +const isDecompressFile = (row: File.File) => { + if (row.isDir) { + return false; + } + if (getFileType(row.extension) === 'compress') { + return true; + } + if (row.mimeType == 'application/octet-stream') { + return false; + } else { + return Mimetypes.get(row.mimeType) != undefined; + } +}; + onMounted(() => { if (router.currentRoute.value.query.path) { req.path = String(router.currentRoute.value.query.path);