fix: PaC not working with dot git suffixed url (#1713)

Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
Matej Vasek 2023-04-28 21:13:51 +02:00 committed by GitHub
parent 818c5ae20a
commit f2eb853073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -61,5 +61,7 @@ func RepoOwnerAndNameFromUrl(url string) (string, string, error) {
repoOwner := repoArr[0] repoOwner := repoArr[0]
repoName := repoArr[1] repoName := repoArr[1]
repoName = strings.TrimSuffix(repoName, ".git")
return repoOwner, repoName, nil return repoOwner, repoName, nil
} }

View File

@ -17,6 +17,13 @@ func TestGetRepoOwnerFromGHURL(t *testing.T) {
wantName: "bar", wantName: "bar",
wantErr: false, wantErr: false,
}, },
{
name: "correct with dot git suffix",
url: "https://gh/foo/bar.git",
wantOwner: "foo",
wantName: "bar",
wantErr: false,
},
{ {
name: "correct with capital letters", name: "correct with capital letters",
url: "https://gh/FOO/bar", url: "https://gh/FOO/bar",