Skip to content

Commit

Permalink
fix: Trim trailing slash from Gitea URL (#3488)
Browse files Browse the repository at this point in the history
This PR will truncate any trailing slash left by specifying only a Gitea
API URL.

Fixes #3487

I have not added any tests for this.

Signed-off-by: Sam Therapy <sam@samtherapy.net>
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
SamTherapy and caarlos0 committed Oct 22, 2022
1 parent f1e6305 commit 154c520
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/pipe/defaults/defaults.go
Expand Up @@ -35,7 +35,7 @@ func (Pipe) Run(ctx *context.Context) error {
return fmt.Errorf("templating Gitea API URL: %w", err)
}

ctx.Config.GiteaURLs.Download = strings.ReplaceAll(apiURL, "/api/v1", "")
ctx.Config.GiteaURLs.Download = strings.TrimSuffix(strings.ReplaceAll(apiURL, "/api/v1", ""), "/")
}
for _, defaulter := range defaults.Defaulters {
if err := errhandler.Handle(defaulter.Default)(ctx); err != nil {
Expand Down

0 comments on commit 154c520

Please sign in to comment.