15685: Adds empty dir name validation to rename file dialog.
[arvados-workbench2.git] / 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