Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #663 from profclems/fix-id-placeholder
Browse files Browse the repository at this point in the history
fix(commands/api): replace `:id` placeholder with project ID
  • Loading branch information
profclems authored Mar 22, 2021
2 parents 4dd9ee9 + dc23620 commit 6e21a96
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion commands/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,15 @@ func fillPlaceholders(value string, opts *ApiOptions) (string, error) {

filled := placeholderRE.ReplaceAllStringFunc(value, func(m string) string {
switch m {
case ":group/:namespace/:repo", ":fullpath", ":id":
case ":id":
h, _ := opts.HttpClient()
baseProject, e := api.GetProject(h, baseRepo.FullName())
if e == nil && baseProject != nil {
return string(rune(baseProject.ID))
}
err = e
return ""
case ":group/:namespace/:repo", ":fullpath":
return url.PathEscape(baseRepo.FullName())
case ":namespace/:repo":
return url.PathEscape(baseRepo.RepoNamespace() + "/" + baseRepo.RepoName())
Expand Down

0 comments on commit 6e21a96

Please sign in to comment.