Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not possible to list artifacts with repository that contains "/" #34

Open
jonsv322 opened this issue Dec 21, 2024 · 0 comments
Open

Not possible to list artifacts with repository that contains "/" #34

jonsv322 opened this issue Dec 21, 2024 · 0 comments

Comments

@jonsv322
Copy link

ParseProjectRepo does not handle repositories correctly.

E.g. myproject/foo/bar will fail with an 404 error.

diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go
index 5bff783..83f4330 100644
--- a/pkg/utils/utils.go
+++ b/pkg/utils/utils.go
@@ -39,11 +39,19 @@ func PrintPayloadInYAMLFormat(payload any) {
 }

 func ParseProjectRepo(projectRepo string) (string, string) {
+       project := ""
+       repo := ""
        split := strings.Split(projectRepo, "/")
-       if len(split) != 2 {
+       if len(split) > 2 {
+               project = split[0]
+               repo = strings.Join(split[1:], "%2F")
+       } else if len(split) == 2 {
+               project = split[0]
+               repo = split[1]
+       } else {
                log.Fatalf("invalid project/repository format: %s", projectRepo)
        }
-       return split[0], split[1]
+       return project, repo
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant