We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在“app/view/main_window.py”源文件中的__init__函数(50行)的读取配置文件部分使用了eval函数,这并不安全,建议使用json.loads或者ast.literal_eval等安全的加载方式作为替代
__init__
json.loads
ast.literal_eval
def __init__(self): super().__init__() self.initWindow() # create sub interface self.taskInterface = TaskInterface(self) self.settingInterface = SettingInterface(self) # self.debugInterface = DebugInterface(self) # add items to navigation interface self.initNavigation() # 设置背景特效 self.applyBackgroundEffectByCfg() # 创建检测主题色更改线程 self.themeChangedListener = ThemeChangedListener(self) self.themeChangedListener.themeChanged.connect(self.toggleTheme) self.themeChangedListener.start() # 创建未完成的任务 historyFile = Path("{}/Ghost Downloader 记录文件".format(cfg.appPath)) # 未完成任务记录文件格式示例: [{"url": "xxx", "fileName": "xxx", "filePath": "xxx", "blockNum": x, "status": "xxx"}] if historyFile.exists(): with open(historyFile, 'r', encoding='utf-8') as f: unfinishedTaskInfo = f.readlines() logger.debug(f"Unfinished Task is following:{unfinishedTaskInfo}") for i in unfinishedTaskInfo: if i: # 避免空行 # i = eval(i) # <=========== # i = ast.literal_eval(i) <========== # i = json.loads(i) <=========== signalBus.addTaskSignal.emit(i['url'], i['filePath'], i['blockNum'], i['fileName'], i["status"], True) else: historyFile.touch() # 启动浏览器扩展服务器 self.browserExtensionServer = None if cfg.enableBrowserExtension.value == True: self.runBrowserExtensionServer() # 创建托盘 self.tray = CustomSystemTrayIcon(self) self.tray.show() # 检查更新 if cfg.checkUpdateAtStartUp.value == True: checkUpdate(self) self.splashScreen.finish()
The text was updated successfully, but these errors were encountered:
感谢 Issue!亟待修复
Sorry, something went wrong.
用 literal_eval 代替 eval (#52)
e49a636
2a00ec8
No branches or pull requests
在“app/view/main_window.py”源文件中的
__init__
函数(50行)的读取配置文件部分使用了eval函数,这并不安全,建议使用json.loads
或者ast.literal_eval
等安全的加载方式作为替代The text was updated successfully, but these errors were encountered: