diff --git a/web/src/components/filePathInputModal.tsx b/web/src/components/filePathInputModal.tsx index a75dedc..d1eeaa5 100644 --- a/web/src/components/filePathInputModal.tsx +++ b/web/src/components/filePathInputModal.tsx @@ -22,8 +22,14 @@ const FilePathInputModal = ({ const handleChange = (event: React.ChangeEvent) => { const value = event.target.value - const regex = /\.(exe|sh|htaccess)$/i - if (regex.test(value)) { + + const specialChars = /[`!@#$%^&*()_+\-=[\]{};':"\\|,<>?~]/ + const fileExtension = /\.(exe|sh|htaccess)$/i + + if (specialChars.test(value)) { + setHasError(true) + setErrorText('can not have special characters') + } else if (fileExtension.test(value)) { setHasError(true) setErrorText('can not save file with extensions [exe, sh, htaccess]') } else { diff --git a/web/src/containers/Studio/editor.tsx b/web/src/containers/Studio/editor.tsx index 57b98aa..0ecb218 100644 --- a/web/src/containers/Studio/editor.tsx +++ b/web/src/containers/Studio/editor.tsx @@ -223,6 +223,10 @@ const SASjsEditor = ({ const saveFile = (filePath?: string) => { setIsLoading(true) + if (filePath) { + filePath = filePath.startsWith('/') ? filePath : `/${filePath}` + } + const formData = new FormData() const stringBlob = new Blob([fileContent], { type: 'text/plain' })