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

fix: github orgs and ssh remote url parser #76

Merged
merged 3 commits into from
Jan 22, 2022

Conversation

stanistan
Copy link
Contributor

Was testing this with a private github organization, and given the string, the tool would have a nil pointer exception at the re-parsing phase of getting the commitUrl.

Added:

  • a change to no longer ignore the error but at least panic with a helpful message
  • a case statement for file

This is definitely a rough fix, but something I tested while debugging the issue.

@@ -133,6 +139,15 @@ func Transform(g *client.GitClient, splices []*ExtractSplice) ([]*TemplateContex
if remoteURL, err = url.Parse(fmt.Sprintf("%s://%s%s", remoteURL.Scheme, remoteURL.Host, urlPath)); err != nil {
return nil, errors.WithStack(err)
}
case "file":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide an example URL for testing? I'm curious how it parses into the file protocol

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our remotes look like: org-1232456@github.com:USER/REPO.git and the url parser utility doesn't really know how to deal with them: https://go.dev/play/p/7jUtvntFvdl

Copy link
Member

@axetroy axetroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@axetroy axetroy changed the title Fix for github orgs and ssh fix: github orgs and ssh remote url parser Jan 22, 2022
@axetroy axetroy merged commit dd9f035 into release-lab:master Jan 22, 2022
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

Successfully merging this pull request may close these issues.

2 participants