From cca3a5a8998f0d26dbb0a65b2a2e15c872a7c653 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 22 Nov 2022 15:08:03 +0800 Subject: [PATCH] up --- class/core/mw.py | 6 ++++++ plugins/mysql/index.py | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/class/core/mw.py b/class/core/mw.py index d8f7fecf6..029192ff2 100755 --- a/class/core/mw.py +++ b/class/core/mw.py @@ -167,6 +167,12 @@ def getOsID(): return data[0].strip() +def getFileSuffix(file): + tmp = file.split('.') + ext = tmp[len(tmp) - 1] + return ext + + def isAppleSystem(): if getOs() == 'darwin': return True diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index 504c483fc..a4cc546d3 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -857,8 +857,7 @@ def importDbExternal(): return mw.returnJson(False, '文件突然消失?') exts = ['sql', 'gz', 'zip'] - tmp = file.split('.') - ext = tmp[len(tmp) - 1] + ext = mw.getFileSuffix(file) if ext not in exts: return mw.returnJson(False, '导入数据库格式不对!') @@ -887,6 +886,9 @@ def importDbExternal(): mw.execShell(cmd) import_sql = import_dir + tmpFile + if file.find(".sql") > -1 and file.find(".sql.gz") == -1: + import_sql = import_dir + tmpFile + if import_sql == "": return mw.returnJson(False, '未找SQL文件')