15685: Adds empty dir name validation to rename file dialog.
authorLucas Di Pentima <lucas@di-pentima.com.ar>
Wed, 11 Nov 2020 21:25:45 +0000 (18:25 -0300)
committerLucas Di Pentima <lucas@di-pentima.com.ar>
Wed, 11 Nov 2020 21:25:45 +0000 (18:25 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>

src/validators/valid-name.tsx

index 000e27b004b6aa9922eff5de1d6f74d460dc1657..c3650542714b371348112e6bdc9f15b56eb4b15f 100644 (file)
@@ -29,6 +29,9 @@ export const validFileName = (value: string) => {
 };
 
 export const validFilePath = (filePath: string) => {
-    const errors = filePath.split('/').map(pathPart => validFileName(pathPart));
+    const errors = filePath.split('/').map(pathPart => {
+        if (pathPart === "") { return "Empty dir name not allowed"; }
+        return validFileName(pathPart);
+    });
     return errors.filter(e => e !== undefined)[0];
 };
\ No newline at end of file