1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-04 13:25:26 +02:00

fix(gitops): clean trailing slash [EE-6346] (#10777)

Co-authored-by: testa113 <testa113>
This commit is contained in:
Ali 2023-12-07 13:43:01 +13:00 committed by GitHub
parent a2d6d6002c
commit 4e8b371fb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 16 deletions

View file

@ -32,3 +32,10 @@ export function confirmEnableTLSVerify() {
'Enabling the verification of TLS certificates without ensuring the correct configuration of your Certificate Authority (CA) for self-signed certificates can result in deployment failures.',
});
}
export function cleanGitRepoUrl(url: string) {
return url
.trim() // remove leading and trailing whitespace
.replace(/\/$/, '') // if there's a trailing slash, remove it
.replace(/\.git$/, ''); // if there's a trailing .git extension, remove it
}