mirror of
https://github.com/sasjs/server.git
synced 2026-01-07 22:50:05 +00:00
fix: code fixes for executing program from program path including file extension
This commit is contained in:
@@ -32,7 +32,17 @@ export class FileUploadController {
|
||||
|
||||
const programPath = (query?._program ?? body?._program) as string
|
||||
|
||||
const { runTime } = await getRunTimeAndFilePath(programPath)
|
||||
let runTime
|
||||
|
||||
try {
|
||||
;({ runTime } = await getRunTimeAndFilePath(programPath))
|
||||
} catch (err: any) {
|
||||
res.status(400).send({
|
||||
status: 'failure',
|
||||
message: 'Job execution failed',
|
||||
error: typeof err === 'object' ? err.toString() : err
|
||||
})
|
||||
}
|
||||
|
||||
const sessionController =
|
||||
runTime === RunTimeType.SAS
|
||||
|
||||
@@ -131,9 +131,9 @@ const executeReturnRaw = async (
|
||||
): Promise<string | Buffer> => {
|
||||
const query = req.query as ExecutionVars
|
||||
|
||||
const { codePath, runTime } = await getRunTimeAndFilePath(_program)
|
||||
|
||||
try {
|
||||
const { codePath, runTime } = await getRunTimeAndFilePath(_program)
|
||||
|
||||
const { result, httpHeaders } =
|
||||
(await new ExecutionController().executeFile({
|
||||
programPath: codePath,
|
||||
@@ -169,13 +169,13 @@ const executeReturnJson = async (
|
||||
req: express.Request,
|
||||
_program: string
|
||||
): Promise<ExecuteReturnJsonResponse> => {
|
||||
const { codePath, runTime } = await getRunTimeAndFilePath(_program)
|
||||
|
||||
const filesNamesMap = req.files?.length
|
||||
? makeFilesNamesMap(req.files as MulterFile[])
|
||||
: null
|
||||
|
||||
try {
|
||||
const { codePath, runTime } = await getRunTimeAndFilePath(_program)
|
||||
|
||||
const { webout, log, httpHeaders } =
|
||||
(await new ExecutionController().executeFile({
|
||||
programPath: codePath,
|
||||
|
||||
Reference in New Issue
Block a user