diff --git a/back/api/script.ts b/back/api/script.ts index e304b768..1bf85565 100644 --- a/back/api/script.ts +++ b/back/api/script.ts @@ -232,7 +232,7 @@ export default (app: Router) => { celebrate({ body: Joi.object({ filename: Joi.string().required(), - path: Joi.string().allow(''), + path: Joi.string().optional().allow(''), }), }), async (req: Request, res: Response, next: NextFunction) => { @@ -241,6 +241,9 @@ export default (app: Router) => { filename: string; path: string; }; + if (!path) { + path = ''; + } const scriptService = Container.get(ScriptService); const filePath = scriptService.checkFilePath(path, filename); if (!filePath) { diff --git a/back/config/util.ts b/back/config/util.ts index 96070009..e6a77219 100644 --- a/back/config/util.ts +++ b/back/config/util.ts @@ -517,7 +517,7 @@ export async function setSystemTimezone(timezone: string): Promise { export function getGetCommand(type: DependenceTypes, name: string): string { const baseCommands = { [DependenceTypes.nodejs]: `pnpm ls -g | grep "${name}" | head -1`, - [DependenceTypes.python3]: `python3 -c "import importlib;pkg=importlib.import_module('${name}');print(getattr(pkg, '__version__', 'version not found'))"`, + [DependenceTypes.python3]: `python3 -c "import importlib;pkg=importlib.import_module('${name}');print(getattr(pkg, '__version__', 'inner package'))"`, [DependenceTypes.linux]: `apk info -es ${name}`, };