代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/A-Tune 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 34007d0d2fba94e43fbaf294d18cb2fc68857116 Mon Sep 17 00:00:00 2001
From: gaoruoshu <[email protected]>
Date: Wed, 9 Aug 2023 15:07:04 +0800
Subject: [PATCH 1/3] bugfix: transfer can only save file to specified dir
---
analysis/engine/transfer.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/analysis/engine/transfer.py b/analysis/engine/transfer.py
index 7fa5777..154f3df 100644
--- a/analysis/engine/transfer.py
+++ b/analysis/engine/transfer.py
@@ -31,7 +31,7 @@ LOGGER = logging.getLogger(__name__)
class Transfer(Resource):
"""restful api for transfer"""
- file_path = "/etc/atuned/"
+ file_path = "/etc/atuned/{service}"
def post(self):
"""provide the method of post"""
@@ -40,15 +40,19 @@ class Transfer(Resource):
file_obj = request.files.get("file")
service = request.form.get("service")
+ target_path = self.file_path.format(service=service)
+ dir_name, _ = os.path.split(os.path.abspath(save_path))
+ if not dir_name == target_path:
+ return "illegal path to save file", 400
+
if service == "classification":
os.makedirs(ANALYSIS_DATA_PATH, exist_ok=True)
- file_name = ANALYSIS_DATA_PATH + save_path.split(self.file_path + service)[1][1:]
+ file_name = ANALYSIS_DATA_PATH + save_path.split(target_path)[1][1:]
current_app.logger.info(file_name)
file_obj.save(file_name)
return file_name, 200
file_obj.save(save_path)
- target_path = self.file_path + service
res = utils.extract_file(save_path, target_path)
os.remove(save_path)
return res, 200
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。