Skip to content

Commit

Permalink
change backslash validation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandria.gomez authored and alexandria.gomez committed Oct 18, 2023
1 parent 714ea73 commit 0107252
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ function ImportFileModal(props: {
}
const extension = PathUtils.getCleanedExtension(fileData.name);
const renamedFile = new File([fileData], fileName + extension);
const fileContainsBacklash = fileName.includes('\\');
const fileContainsBackslash = fileName.includes('\\');
try {
const entryWithPathExists =
await props.repoClient.entriesClient.getEntryByPath({
Expand Down Expand Up @@ -493,7 +493,7 @@ function ImportFileModal(props: {
throw err;
}
}
if (fileContainsBacklash) {
if (fileContainsBackslash) {
setFileUploadPercentage(0);
setImportFileValidationMessage(fileNameWithBacklash);
return;
Expand Down Expand Up @@ -725,7 +725,8 @@ function CreateFolderModal(props: {

const createNewFolderAsync: () => Promise<void> = async () => {
if (folderName) {
if (/^[\\\\]*$/.test(folderName)) {
const fileContainsBackslash = folderName.includes('\\');
if (fileContainsBackslash) {
setCreateFolderNameValidationMessage(folderBackslashNameValidation);
} else {
setCreateFolderNameValidationMessage(undefined);
Expand Down

0 comments on commit 0107252

Please sign in to comment.