Skip to content
Permalink
Browse files
fix: Trim trailing slash from Gitea URL (#3488)
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 154c52075526c3819a97d9b610ceaf2e97628c86
Showing 1 changed file with 1 addition and 1 deletion.
@@ -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 {

0 comments on commit 154c520

Please sign in to comment.