Skip to content

Commit

Permalink
Update util.go
Browse files Browse the repository at this point in the history
Signed-off-by: Johan Lore <jlore@ippon.fr>
  • Loading branch information
Johan Lore committed Nov 17, 2020
1 parent a7e3be0 commit 8e4cf16
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/notifier/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ func parseGitAddress(s string) (string, string, error) {

path := strings.TrimLeft(u.Path, "/")
comp := strings.Split(path, "/")
if len(comp) != 2 {
return "", "", fmt.Errorf("Incorrectly formatted git address: %v", s)
}

var id strings.Builder
host := fmt.Sprintf("https://%s", u.Host)
id := comp[0] + "/" + strings.TrimSuffix(comp[1], ".git")
return host, id, nil
id.WriteString(comp[0])
for i := 1; i < len(comp); i++ {
id.WriteString("/" + strings.TrimSuffix(comp[i], ".git"))
}
return host, id.String(), nil
}

func formatNameAndDescription(event recorder.Event) (string, string) {
Expand Down

0 comments on commit 8e4cf16

Please sign in to comment.