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 go get response if only app URL is custom in configuration #2634

Merged
merged 3 commits into from
Oct 2, 2017

Conversation

lafriks
Copy link
Member

@lafriks lafriks commented Oct 1, 2017

Fixes #2633

@lafriks lafriks added this to the 1.3.0 milestone Oct 1, 2017
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)
Copy link
Member

Choose a reason for hiding this comment

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

need return?

@codecov-io
Copy link

codecov-io commented Oct 1, 2017

Codecov Report

Merging #2634 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a8717e5...e946f81. Read the comment docs.

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 1, 2017
@lafriks
Copy link
Member Author

lafriks commented Oct 1, 2017

@lunny fixed

@ethantkoenig
Copy link
Member

LGTM

@tboerger tboerger added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Oct 1, 2017
@sapk
Copy link
Member

sapk commented Oct 2, 2017

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.

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Oct 2, 2017
@lafriks
Copy link
Member Author

lafriks commented Oct 2, 2017

@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
Copy link
Member

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 :

func ComposeGoGetImport(owner, repo string) string {

path.Join(setting.Domain, setting.AppSubURL, owner, repo)

Copy link
Member

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

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member

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 ?

Copy link
Member

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.

Copy link
Member Author

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

@sapk
Copy link
Member

sapk commented Oct 2, 2017

New version LGTM.

@lunny lunny merged commit 46cc45f into go-gitea:master Oct 2, 2017
lafriks added a commit to lafriks-fork/gitea that referenced this pull request Oct 2, 2017
…tea#2634)

* Fix go get response if only app URL is custom in configuration

* Rewrite to update Domain setting to match AppURL
@lafriks lafriks added the backport/done All backports for this PR have been created label Oct 2, 2017
lafriks added a commit that referenced this pull request Oct 3, 2017
#2640)

* Fix go get response if only app URL is custom in configuration

* Rewrite to update Domain setting to match AppURL
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

godoc not showing documentation for gitea repos
6 participants