1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 export const disallowDotName = /^\.{1,2}$/;
6 export const disallowSlash = /\//;
8 const ERROR_MESSAGE = "Name cannot be '.' or '..' or contain '/' characters";
10 export const validName = (value: string) => {
11 return [disallowDotName, disallowSlash].find(aRule => value.match(aRule) !== null)
16 export const validNameAllowSlash = (value: string) => {
17 return [disallowDotName].find(aRule => value.match(aRule) !== null)
18 ? "Name cannot be '.' or '..'"