fix: secure file routes and dependency management

This commit is contained in:
whyour
2026-08-29 19:10:30 +08:00
parent 0e975d1d6d
commit 5f6049d80a
13 changed files with 525 additions and 79 deletions
+12 -4
View File
@@ -609,10 +609,18 @@ export default class SystemService {
if (!type || !['node', 'python3'].includes(type)) {
return { code: 400, message: t('参数错误') };
}
try {
const finalPath = path.join(config.dependenceCachePath, type);
await fs.promises.rm(finalPath, { recursive: true });
} catch (error) { }
const finalPath = path.join(config.dependenceCachePath, type);
await fs.promises.rm(finalPath, { recursive: true, force: true });
await DependenceModel.update(
{ status: DependenceStatus.installFailed },
{
where: {
type:
type === 'node' ? DependenceTypes.nodejs : DependenceTypes.python3,
status: DependenceStatus.installed,
},
},
);
return { code: 200 };
}
}