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

the gitea API return wrong url for submodule files #22614

Closed
c-my opened this issue Jan 27, 2023 · 0 comments · Fixed by #23043
Closed

the gitea API return wrong url for submodule files #22614

c-my opened this issue Jan 27, 2023 · 0 comments · Fixed by #23043
Assignees
Labels
Milestone

Comments

@c-my
Copy link

c-my commented Jan 27, 2023

Description

There is a submodule in my repo (https://try.gitea.io/c-my/test).

If I request the api endpoint “https://try.gitea.io/api/v1/repos/c-my/test/git/trees/main?recursive=true”, there will be following contents in the response:

...
    {
      "path": "themes/butterfly",
      "mode": "160000",
      "type": "commit",
      "size": 0,
      "sha": "08fabdc2d14c3f6d52f0193c709313eed21b5c07",
      "url": "https://try.gitea.io/api/v1/repos/c-my/test/git/blobs/08fabdc2d14c3f6d52f0193c709313eed21b5c07"
    }
...

But I got 404 error when requesting the url "https://try.gitea.io/api/v1/repos/c-my/test/git/blobs/08fabdc2d14c3f6d52f0193c709313eed21b5c07". Because the real url should be https://github.com/jerryc127/hexo-theme-butterfly/commit/08fabdc2d14c3f6d52f0193c709313eed21b5c07.

The link is correct in web UI but not in API, so I think this can/should be fixed.

Gitea Version

1.19.0+dev-356-g4f8c0eba9

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

https://try.gitea.io/

Database

None

@c-my c-my added the type/bug label Jan 27, 2023
@c-my c-my changed the title the vitea API return wrong url for submodule files the gitea API return wrong url for submodule files Jan 27, 2023
@Zettat123 Zettat123 self-assigned this Feb 21, 2023
@lunny lunny added this to the 1.18.5 milestone Feb 21, 2023
techknowlogick pushed a commit that referenced this issue Feb 21, 2023
Close #22614.

Refer to [Github's
API](https://docs.github.com/en/rest/git/trees?apiVersion=2022-11-28#get-a-tree),
if a tree entry is a submodule, its url will be an empty string.

---------

Co-authored-by: delvh <leon@kske.dev>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
yardenshoham pushed a commit to yardenshoham/gitea that referenced this issue Feb 21, 2023
Close go-gitea#22614.

Refer to [Github's
API](https://docs.github.com/en/rest/git/trees?apiVersion=2022-11-28#get-a-tree),
if a tree entry is a submodule, its url will be an empty string.

---------

Co-authored-by: delvh <leon@kske.dev>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
techknowlogick pushed a commit that referenced this issue Feb 21, 2023
Backport #23043

Close #22614.

Refer to [Github's
API](https://docs.github.com/en/rest/git/trees?apiVersion=2022-11-28#get-a-tree),
if a tree entry is a submodule, its url will be an empty string.

Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-authored-by: delvh <leon@kske.dev>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Codeberg-org pushed a commit to Codeberg-org/gitea that referenced this issue Feb 23, 2023
…a#23048)

Backport go-gitea#23043

Close go-gitea#22614.

Refer to [Github's
API](https://docs.github.com/en/rest/git/trees?apiVersion=2022-11-28#get-a-tree),
if a tree entry is a submodule, its url will be an empty string.

Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-authored-by: delvh <leon@kske.dev>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
(cherry picked from commit 8f5b2f1)
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
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.

3 participants