From 5cc85b57f80b13296156811fe966d7b37d45f213 Mon Sep 17 00:00:00 2001 From: Sabir Hassan Date: Wed, 22 Jun 2022 14:24:06 +0500 Subject: [PATCH 1/2] fix: getRuntimeAndFilePath function to handle the scenarion when path is provided with an extension other than runtimes --- api/src/utils/getRunTimeAndFilePath.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/api/src/utils/getRunTimeAndFilePath.ts b/api/src/utils/getRunTimeAndFilePath.ts index e36c931..74ea7b2 100644 --- a/api/src/utils/getRunTimeAndFilePath.ts +++ b/api/src/utils/getRunTimeAndFilePath.ts @@ -6,13 +6,8 @@ import { RunTimeType } from '.' export const getRunTimeAndFilePath = async (programPath: string) => { const ext = path.extname(programPath) // if program path is provided with extension we should split that into code path and ext as run time - if (ext) { + if (ext && Object.values(RunTimeType).includes(ext.slice(1) as RunTimeType)) { const runTime = ext.slice(1) - const runTimeTypes = Object.values(RunTimeType) - - if (!runTimeTypes.includes(runTime as RunTimeType)) { - throw `The '${runTime}' runtime is not supported.` - } const codePath = path .join(getFilesFolder(), programPath) From d3d2ab9a36b1f68a90833f3f855e4e2c0baa1e94 Mon Sep 17 00:00:00 2001 From: Allan Bowe <4420615+allanbowe@users.noreply.github.com> Date: Wed, 22 Jun 2022 11:12:48 +0100 Subject: [PATCH 2/2] Update getRunTimeAndFilePath.ts --- api/src/utils/getRunTimeAndFilePath.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/src/utils/getRunTimeAndFilePath.ts b/api/src/utils/getRunTimeAndFilePath.ts index 74ea7b2..b83cdee 100644 --- a/api/src/utils/getRunTimeAndFilePath.ts +++ b/api/src/utils/getRunTimeAndFilePath.ts @@ -5,7 +5,8 @@ import { RunTimeType } from '.' export const getRunTimeAndFilePath = async (programPath: string) => { const ext = path.extname(programPath) - // if program path is provided with extension we should split that into code path and ext as run time + // If programPath (_program) is provided with a ".sas" or ".js" extension + // we should use that extension to determine the appropriate runTime if (ext && Object.values(RunTimeType).includes(ext.slice(1) as RunTimeType)) { const runTime = ext.slice(1)