Mind review findings

This commit is contained in:
Eduard Heimbuch
2020-12-02 10:42:26 +01:00
parent e7b7bf5b0f
commit 7db33d2e65
18 changed files with 152 additions and 351 deletions

View File

@@ -70,8 +70,7 @@ const ImportRepositoryFromUrl: FC<Props> = ({ url, setImportPending }) => {
.post(url, repo, "application/vnd.scmm-repository+json;v=2")
.then(response => {
const location = response.headers.get("Location");
// @ts-ignore Location is always set if the repository import was successful
return apiClient.get(location);
return apiClient.get(location!);
})
.then(response => response.json())
.then(repo => {

View File

@@ -25,11 +25,10 @@
import { validation } from "@scm-manager/ui-components";
const nameRegex = /(?!^\.\.$)(?!^\.$)(?!.*[.]git$)(?!.*[\\\[\]])^[A-Za-z0-9\.][A-Za-z0-9\.\-_]*$/;
const namespaceExceptionsRegexCreate = /^(([0-9]{1,3})|(create))$/;
const namespaceExceptionsRegexImport = /^(([0-9]{1,3})|(import))$/;
const namespaceExceptionsRegex = /^(([0-9]{1,3})|(create)|(import))$/;
export const isNamespaceValid = (name: string) => {
return nameRegex.test(name) && !namespaceExceptionsRegexCreate.test(name) && !namespaceExceptionsRegexImport.test(name);
return nameRegex.test(name) && !namespaceExceptionsRegex.test(name);
};
export const isNameValid = (name: string) => {