X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/f5a3876fd7c35c57e9d3eb037278160844858c25..c29de730b2cf8582667e21bc985530a804797186:/src/validators/valid-name.tsx

diff --git a/src/validators/valid-name.tsx b/src/validators/valid-name.tsx
index 468811d8..da967123 100644
--- a/src/validators/valid-name.tsx
+++ b/src/validators/valid-name.tsx
@@ -2,13 +2,19 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
+export const disallowDotName = /^\.{1,2}$/;
+export const disallowSlash = /\//;
 
 const ERROR_MESSAGE = "Name cannot be '.' or '..' or contain '/' characters";
 
-export const invalidNamingRules = [/\//, /^\.{1,2}$/];
-
 export const validName = (value: string) => {
-    return invalidNamingRules.find(aRule => value.match(aRule) !== null)
+    return [disallowDotName, disallowSlash].find(aRule => value.match(aRule) !== null)
         ? ERROR_MESSAGE
         : undefined;
 };
+
+export const validNameAllowSlash = (value: string) => {
+    return [disallowDotName].find(aRule => value.match(aRule) !== null)
+        ? "Name cannot be '.' or '..'"
+        : undefined;
+};
