gruntwork-io / fetch

Download files, folders, and release assets from a specific git commit, branch, or tag of public and private GitHub repos.
https://www.gruntwork.io/
MIT License
595 stars 87 forks source link

fetch doesn't work with "SUB" domain in repo URL #14

Closed girishkg closed 7 years ago

girishkg commented 8 years ago

fetch is not working if there are any subdomain in the "--repo" option fetch --repo="https://example.github.com/foo/bar" --tag="0.1.5" --release-asset="foo.exe" /tmp

The error is:

[root@jenkins01 ~]# fetch --repo="https://example.github.com/foo/bar" --tag="0.1.5" --release-asset="foo.exe" /tmp
ERROR: Error occurred while getting tags from GitHub repo: -1 - 300 - GitHub Repo URL https://example.github.com/foo/bar could not be parsed correctly

"example" SUB domain is used here for demonstration purpose.

girishkg commented 8 years ago

Need to change line "102" on "github.go" file regex, regexErr := regexp.Compile("https?://(?:www\\.)?github.com/(.+?)/(.+?)(?:$|\\?|#|/)")

josh-padnick commented 8 years ago

@girishkg Thanks for the issue report! I actually didn't realize github repo URLs could have subdomains, and, as you pointed out in your second comment, the code assumes all github repos are at www.github.com or github.com.

Can you give an example of a (presumably public) repo that has a subdomain in the name other than www? If we can determine this is a legitimate use case, I'd be happy to add support for this.

josh-padnick commented 7 years ago

Closing due to inactivity. @girishkg Feel free to re-open if applicable.