-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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 go get response if only app URL is custom in configuration #2634
Conversation
modules/context/repo.go
Outdated
return path.Join(setting.Domain, setting.AppSubURL, owner, repo) | ||
baseURL, err := url.Parse(setting.AppURL) | ||
if err != nil { | ||
path.Join(setting.Domain, setting.AppSubURL, owner, repo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need return?
Codecov Report
@@ Coverage Diff @@
## master #2634 +/- ##
=======================================
Coverage 27.11% 27.11%
=======================================
Files 86 86
Lines 17064 17064
=======================================
Hits 4627 4627
Misses 11759 11759
Partials 678 678 Continue to review full report at Codecov.
|
e345d6f
to
e4dc106
Compare
@lunny fixed |
LGTM |
LGTM For futur work, couldn't we set setting.Domain at appURL.Hostname globally (if domain is not set in ini) ? If it's ok I could do it. |
936dc0d
to
97ee427
Compare
@ethantkoenig @sapk rewritten as requested and setting.Domain should now always match domain in AppURL except when AppURL has IP adress not domain in host part of URL. |
// TODO: Can be replaced with url.Hostname() when minimal GoLang version is 1.8 | ||
urlHostname := strings.SplitN(url.Host, ":", 2)[0] | ||
if urlHostname != Domain && net.ParseIP(urlHostname) == nil { | ||
Domain = urlHostname |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Domain as it used should contain port at least for the use maid in :
Line 138 in 2ef8b8b
func ComposeGoGetImport(owner, repo string) string { |
path.Join(setting.Domain, setting.AppSubURL, owner, repo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to update the ComposeGoGetImport to add HTTP_PORT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sapk no it should not contain port as it generates go
import
part of repository and go imports can not contain port
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry mislead HTTP_PORT is not necessary the same as the public port ... but we still need to add the url port to the go-import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok sorry that kind of strange how it works if the host is not on defaut port ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh sorry I understand that the repo url after package that contain the port.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes git url is generated in other place. This is just import part
New version LGTM. |
…tea#2634) * Fix go get response if only app URL is custom in configuration * Rewrite to update Domain setting to match AppURL
#2640) * Fix go get response if only app URL is custom in configuration * Rewrite to update Domain setting to match AppURL
Fixes #2633