Not able to go get a repository with non-80 port #3351

Closed
opened 2025-11-02 05:09:33 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @laszbalo on GitHub (May 18, 2019).

  • Gitea version (or commit ref): 1.8.1
  • Git version: 2.17.1
  • Operating system: Xubuntu 19.04
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

According to the gogs issue tracker this issue has been fixed there, but apparently it is still present in gitea.

In my case gitea is running on port 13000 and trying to go get my golang package:

go get -v 192.168.1.66:13000/my_user_name/my_golang_repo

but got the following error:

unrecognized import path "192.168.1.66:13000/my_user_name/my_golang_repo" (parse https://192.168.1.66:13000/my_user_name/my_golang_repo?go-get=1: no go-import meta tags (meta tag 192.168.1.66/my_user_name/my_golang_repo did not match import path 192.168.1.66:13000/my_user_name/my_golang_repo))

Originally created by @laszbalo on GitHub (May 18, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.8.1 - Git version: 2.17.1 - Operating system: Xubuntu 19.04 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description According to the [gogs issue tracker](https://github.com/gogs/gogs/issues/5305) this issue has been fixed there, but apparently it is still present in gitea. In my case gitea is running on port 13000 and trying to **go get** my golang package: ```shell go get -v 192.168.1.66:13000/my_user_name/my_golang_repo ``` but got the following error: unrecognized import path "192.168.1.66:13000/my_user_name/my_golang_repo" (parse https://192.168.1.66:13000/my_user_name/my_golang_repo?go-get=1: no go-import meta tags (meta tag 192.168.1.66/my_user_name/my_golang_repo did not match import path 192.168.1.66:13000/my_user_name/my_golang_repo))
GiteaMirror added the issue/needs-feedback label 2025-11-02 05:09:33 -06:00
Author
Owner

@zeripath commented on GitHub (May 23, 2019):

OK, so even with backporting similar fixes to gitea this won't work:

:; go get -v -insecure 'localhost:3000/administrator/bugpush'        [19:09:51]
package localhost:3000/administrator/bugpush: localhost:3000/administrator/bugpush: invalid import path: malformed import path "localhost:3000/administrator/bugpush": invalid char ':

This is because go get will not allow : in a name.

So how were you testing this? I think there's a way using go mod but if you could provide a quick example that is not working that would be very helpful for me to test this.

@zeripath commented on GitHub (May 23, 2019): OK, so even with backporting similar fixes to gitea this won't work: ``` :; go get -v -insecure 'localhost:3000/administrator/bugpush' [19:09:51] package localhost:3000/administrator/bugpush: localhost:3000/administrator/bugpush: invalid import path: malformed import path "localhost:3000/administrator/bugpush": invalid char ': ``` This is because go get will not allow `:` in a name. So how were you testing this? I think there's a way using go mod but if you could provide a quick example that is not working that would be very helpful for me to test this.
Author
Owner

@zeripath commented on GitHub (May 23, 2019):

So I've pushed a branch https://github.com/zeripath/gitea/tree/adjust-go-get-url-fix-%236985 but not opened a PR yet as I don't understand whether that would fix this.

@zeripath commented on GitHub (May 23, 2019): So I've pushed a branch https://github.com/zeripath/gitea/tree/adjust-go-get-url-fix-%236985 but not opened a PR yet as I don't understand whether that would fix this.
Author
Owner

@laszbalo commented on GitHub (May 23, 2019):

Actually I made it work this afternoon, without changing anything in the Gitea code, but had to go out before I could close this issue.

I think the problem was that inside my app.ini, the DOMAIN key/property did not contain the port number, so I appended it:

DOMAIN           = 192.168.1.66:13000    ; port number was missing before
HTTP_PORT        = 13000

I had enabled go modules before I called go get:

export GO111MODULE=on

Hence I did not get the malformed import path error you posted above.

Appending the custom port number to the domain seemingly solved my particular issue of go getting golang modules, therefore I am not really sure either about what difference the backport would make, or what was the point modifying gogs at the first place. If you cannot think of a use case where your modification would add any value, then I am happy if you close this issue.

@laszbalo commented on GitHub (May 23, 2019): Actually I made it work this afternoon, without changing anything in the Gitea code, but had to go out before I could close this issue. I think the problem was that inside my app.ini, the DOMAIN key/property did not contain the port number, so I appended it: ```ini DOMAIN = 192.168.1.66:13000 ; port number was missing before HTTP_PORT = 13000 ``` I had enabled go modules before I called go get: ```bash export GO111MODULE=on ``` Hence I did not get the malformed import path error you posted above. Appending the custom port number to the domain seemingly solved my particular issue of go getting golang modules, therefore I am not really sure either about what difference the backport would make, or what was the point modifying gogs at the first place. If you cannot think of a use case where your modification would add any value, then I am happy if you close this issue.
Author
Owner

@zeripath commented on GitHub (May 23, 2019):

Hmm so force adding a port number is likely to break other things.

Are you saying that you're getting these using go modules?

Ok that's interesting - do you have a minimal testcase that I can adjust to try this on?

@zeripath commented on GitHub (May 23, 2019): Hmm so force adding a port number is likely to break other things. Are you saying that you're getting these using go modules? Ok that's interesting - do you have a minimal testcase that I can adjust to try this on?
Author
Owner

@laszbalo commented on GitHub (May 23, 2019):

Are you saying that DOMAIN should not contain a port number?

I don't have any testcases, but tomorrow I can write down exactly what I did step by step, if it can help.

@laszbalo commented on GitHub (May 23, 2019): Are you saying that DOMAIN should not contain a port number? I don't have any testcases, but tomorrow I can write down exactly what I did step by step, if it can help.
Author
Owner

@zeripath commented on GitHub (May 25, 2019):

Setting Domain to include the port will break letsencrypt - however it will fix the url.IsExternalURL which appears to be broken probably causing redirects to fail on non-80/non-443 redirects.

@zeripath commented on GitHub (May 25, 2019): Setting Domain to include the port will break letsencrypt - however it will fix the `url.IsExternalURL` which appears to be broken probably causing redirects to fail on non-80/non-443 redirects.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3351