From d00ee1a35aaf62de2cd7e57f40b9f90afeaf5e5a Mon Sep 17 00:00:00 2001 From: dami Date: Fri, 16 May 2025 02:02:20 +0800 Subject: [PATCH] Update file.py --- web/utils/file.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/utils/file.py b/web/utils/file.py index eefb76fee..9c551e8b7 100644 --- a/web/utils/file.py +++ b/web/utils/file.py @@ -146,7 +146,7 @@ def uncompress(sfile, dfile, path): if extension == 'rar' and not mw.checkBinExist('rar'): return mw.returnData(False, 'rar解压命令不存在,请安装!') if extension == '7z' and not mw.checkBinExist('7z'): - return mw.returnData(False, '7z解药命令不存在,请安装!') + return mw.returnData(False, '7z解压命令不存在,请安装!') cmd = "cd " + path + " " @@ -294,10 +294,14 @@ def zip(sfile, dfile, stype, path): if stype == 'zip': mw.execShell("cd '" + path + "' && zip '" + dfile + "' -r '" + sfile + "' > " + tmps + " 2>&1") elif stype == '7z': + if not mw.checkBinExist('7z'): + return mw.returnData(False, '7z解压命令不存在,请安装!') mw.execShell("cd '" + path + "' && 7z a '" + dfile + "' -r '" + sfile + "' > " + tmps + " 2>&1") elif stype == 'tar_gz': mw.execShell("cd '" + path + "' && tar -zcvf '" + dfile + "' " + sfile + " > " + tmps + " 2>&1") elif stype == 'rar': + if not mw.checkBinExist('rar'): + return mw.returnData(False, 'rar解压命令不存在,请安装!') mw.execShell("cd '" + path + "' && rar a '" + dfile + "' '" + sfile + "' > " + tmps + " 2>&1") else: sfiles = ''