mirror of
https://github.com/sasjs/server.git
synced 2025-12-10 11:24:35 +00:00
fix: made files extensions case insensitive
This commit is contained in:
@@ -4,7 +4,7 @@ import { getFilesFolder } from './file'
|
||||
import { RunTimeType } from '.'
|
||||
|
||||
export const getRunTimeAndFilePath = async (programPath: string) => {
|
||||
const ext = path.extname(programPath)
|
||||
const ext = path.extname(programPath).toLowerCase()
|
||||
// If programPath (_program) is provided with a ".sas", ".js", ".py" or ".r" extension
|
||||
// we should use that extension to determine the appropriate runTime
|
||||
if (ext && Object.values(RunTimeType).includes(ext.slice(1) as RunTimeType)) {
|
||||
|
||||
@@ -236,7 +236,9 @@ const useEditor = ({
|
||||
useEffect(() => {
|
||||
if (selectedFilePath) {
|
||||
setIsLoading(true)
|
||||
setSelectedFileExtension(selectedFilePath.split('.').pop() ?? '')
|
||||
setSelectedFileExtension(
|
||||
selectedFilePath.split('.').pop()?.toLowerCase() ?? ''
|
||||
)
|
||||
axios
|
||||
.get(`/SASjsApi/drive/file?_filePath=${selectedFilePath}`)
|
||||
.then((res: any) => {
|
||||
@@ -270,8 +272,8 @@ const useEditor = ({
|
||||
}, [fileContent, selectedFilePath])
|
||||
|
||||
useEffect(() => {
|
||||
if (runTimes.includes(selectedFileExtension))
|
||||
setSelectedRunTime(selectedFileExtension)
|
||||
const fileExtension = selectedFileExtension.toLowerCase()
|
||||
if (runTimes.includes(fileExtension)) setSelectedRunTime(fileExtension)
|
||||
}, [selectedFileExtension, runTimes])
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user