Skip to content

the gitea API return wrong url for submodule files #22614

Closed
@c-my

Description

@c-my

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions