修复对比工具保存文件

This commit is contained in:
whyour 2024-02-07 20:08:10 +08:00
parent f25fe27473
commit 29f0c2c9ac

View File

@ -89,7 +89,10 @@ export default (app: Router) => {
if (config.blackFileList.includes(name)) {
res.send({ code: 403, message: '文件无法访问' });
}
const path = join(config.configPath, name);
let path = join(config.configPath, name);
if (name.startsWith('data/scripts/')) {
path = join(config.rootPath, name);
}
await fs.writeFile(path, content);
res.send({ code: 200, message: '保存成功' });
} catch (e) {