mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
Feature/unicode groupname validation (#1600)
Allow all UTF-8 characters except URL identifiers as user and group names and for namespaces. Fixes #1513 Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
This commit is contained in:
@@ -83,6 +83,11 @@ const NamespaceAndNameFields: FC<Props> = ({ repository, onChange, setValid, dis
|
||||
};
|
||||
|
||||
const renderNamespaceField = () => {
|
||||
let informationMessage = undefined;
|
||||
if (repository?.namespace?.indexOf(" ") > 0) {
|
||||
informationMessage = t("validation.namespaceSpaceWarningText");
|
||||
}
|
||||
|
||||
const props = {
|
||||
label: t("repository.namespace"),
|
||||
helpText: t("help.namespaceHelpText"),
|
||||
@@ -90,7 +95,8 @@ const NamespaceAndNameFields: FC<Props> = ({ repository, onChange, setValid, dis
|
||||
onChange: handleNamespaceChange,
|
||||
errorMessage: t("validation.namespace-invalid"),
|
||||
validationError: namespaceValidationError,
|
||||
disabled: disabled
|
||||
disabled: disabled,
|
||||
informationMessage
|
||||
};
|
||||
|
||||
if (namespaceStrategy === CUSTOM_NAMESPACE_STRATEGY) {
|
||||
|
||||
@@ -23,12 +23,13 @@
|
||||
*/
|
||||
|
||||
import { validation } from "@scm-manager/ui-components";
|
||||
import { isNameValid as isUserNameValid } from "../../../users/components/userValidation";
|
||||
|
||||
const nameRegex = /(?!^\.\.$)(?!^\.$)(?!.*[.]git$)(?!.*[\\\[\]])^[A-Za-z0-9\.][A-Za-z0-9\.\-_]*$/;
|
||||
const namespaceExceptionsRegex = /^(([0-9]{1,3})|(create)|(import))$/;
|
||||
|
||||
export const isNamespaceValid = (name: string) => {
|
||||
return nameRegex.test(name) && !namespaceExceptionsRegex.test(name);
|
||||
return isUserNameValid(name) && !namespaceExceptionsRegex.test(name);
|
||||
};
|
||||
|
||||
export const isNameValid = (name: string) => {
|
||||
|
||||
Reference in New Issue
Block a user