fix(ql3): harden legacy api compatibility

This commit is contained in:
whyour
2026-08-20 19:09:21 +08:00
parent 3c02ae2020
commit 4ea156f189
7 changed files with 867 additions and 7 deletions
+8 -2
View File
@@ -6,7 +6,13 @@ import CronService from './cron';
import ScheduleService, { TaskCallbacks } from './schedule';
import config from '../config';
import { TASK_COMMAND } from '../config/const';
import { getFileContentByName, getPid, killTask, rmPath } from '../config/util';
import {
getFileContentByName,
getPid,
isPathInside,
killTask,
rmPath,
} from '../config/util';
import taskLimit from '../shared/pLimit';
@Service()
@@ -66,7 +72,7 @@ export default class ScriptService {
public checkFilePath(filePath: string, fileName: string) {
const finalPath = path.resolve(config.scriptPath, filePath, fileName);
return finalPath.startsWith(config.scriptPath) ? finalPath : '';
return isPathInside(config.scriptPath, finalPath) ? finalPath : '';
}
public async getFile(filePath: string, fileName: string) {