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