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

Closed
opened 2025-11-02 06:41:19 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @MartB on GitHub (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

332dbe7393/templates/repo/view_list.tmpl (L50)

Screenshots

image

Originally created by @MartB on GitHub (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 https://github.com/go-gitea/gitea/blob/332dbe73935ba960d8769bfc20b8d275922e4137/templates/repo/view_list.tmpl#L50 ## Screenshots ![image](https://user-images.githubusercontent.com/4820905/92332249-c205ea80-f07c-11ea-9dac-5e16aaebd532.png)
GiteaMirror added the type/bug label 2025-11-02 06:41:19 -06:00
Author
Owner

@MartB commented on GitHub (Sep 6, 2020):

I just noticed that this is a duplicate of https://github.com/go-gitea/gitea/issues/9756, any news regarding this?

@MartB commented on GitHub (Sep 6, 2020): I just noticed that this is a duplicate of https://github.com/go-gitea/gitea/issues/9756, any news regarding this?
Author
Owner

@6543 commented on GitHub (Sep 6, 2020):

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

@6543 commented on GitHub (Sep 6, 2020): @MartB I think it is similar or related ... throu I think we can keep both open
Author
Owner

@6543 commented on GitHub (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 ...

@6543 commented on GitHub (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 ...
Author
Owner

@zeripath commented on GitHub (Sep 6, 2020):

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

@zeripath commented on GitHub (Sep 6, 2020): @MartB could you confirm that this is present on try?
Author
Owner

@mrsdizzie commented on GitHub (Sep 6, 2020):

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

ad2bf376df/modules/git/submodule.go (L42)

So this will never match:

ad2bf376df/modules/git/submodule.go (L79)

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 commented on GitHub (Sep 6, 2020): @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: https://github.com/go-gitea/gitea/blob/ad2bf376dfd934394cad46c3ff3e022ca232958f/modules/git/submodule.go#L42 So this will never match: https://github.com/go-gitea/gitea/blob/ad2bf376dfd934394cad46c3ff3e022ca232958f/modules/git/submodule.go#L79 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.
Author
Owner

@MartB commented on GitHub (Sep 8, 2020):

Thanks for looking into that!

@MartB commented on GitHub (Sep 8, 2020): Thanks for looking into that!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5957