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

Submodule links not recognized by web ui when SSH_DOMAIN is used #12747

Closed
MartB opened this issue Sep 6, 2020 · 6 comments · Fixed by #12753
Closed

Submodule links not recognized by web ui when SSH_DOMAIN is used #12747

MartB opened this issue Sep 6, 2020 · 6 comments · Fixed by #12753
Labels

Comments

@MartB
Copy link

MartB commented Sep 6, 2020

  • Gitea version (or commit ref): 1.12.4

Description

When using a different domain for ssh access, submodules links are not correct within the gitea web interface.

Having a .gitmodules set up like this:

...
url = ssh://gitea@ssh.martb.eu/....

and a gitea instance set up with https://git.martb.eu/ with its SSH_DOMAIN set to ssh.martb.eu leads to ssh. being used as a http href instead of gitea translating it to the "known" git. domain.

Affected lines

{{$refURL := $commit.RefURL AppUrl $.Repository.FullName}}

Screenshots

image

@MartB
Copy link
Author

MartB commented Sep 6, 2020

I just noticed that this is a duplicate of #9756, any news regarding this?

@6543
Copy link
Member

6543 commented Sep 6, 2020

@MartB I think it is similar or related ... throu I think we can keep both open

@6543 6543 added the type/bug label Sep 6, 2020
@6543
Copy link
Member

6543 commented Sep 6, 2020

there was done some work on submodule recognizion in the master branch some time ago , so it has to be checked if this is still present on master ...

@zeripath
Copy link
Contributor

zeripath commented Sep 6, 2020

@MartB could you confirm that this is present on try?

@mrsdizzie
Copy link
Member

@zeripath I don't think you can check this on try because it doesn't use a different domain name for SSH_HOST and DOMAIN

The issue is that we use AppUrl as the urlPrefix value here:

func getRefURL(refURL, urlPrefix, repoFullName string) string {

So this will never match:

if urlPrefixHostname == refHostname {

Because they use a different hostname in the submodule file that matches the separate hostname they have used for SSH_DOMAIN. So our logic thinks this is hosted elsewhere but really it is still the same copy of Gitea just with a different hostname for SSH_DOMAIN.

I think the issue here is that we need to also check if the hostname found in the submodule file matches the SSH_DOMAIN value and then create the link with the AppUrl instead.

mrsdizzie added a commit to mrsdizzie/gitea that referenced this issue Sep 6, 2020
Right now we only compare the hostname from a submodule with the prefixURL it is viewed from to check if the submodule is hosted on the same Gitea instance. This adds an additional check to compare it against SSH_DOMAIN as well since the same Gitea instance might have a different hostname for SSH and if the submodule uses that hostname we should also detect that and link to the proper DOMAIN value.

Fixes go-gitea#12747, go-gitea#9756
techknowlogick pushed a commit that referenced this issue Sep 8, 2020
Right now we only compare the hostname from a submodule with the prefixURL it is viewed from to check if the submodule is hosted on the same Gitea instance. This adds an additional check to compare it against SSH_DOMAIN as well since the same Gitea instance might have a different hostname for SSH and if the submodule uses that hostname we should also detect that and link to the proper DOMAIN value.

Fixes #12747, #9756
@MartB
Copy link
Author

MartB commented Sep 8, 2020

Thanks for looking into that!

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants