mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-08 18:04:14 +01:00
Return empty url for submodule tree entries (#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: delvh <leon@kske.dev> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
a7e98d70b6
commit
4de5cd9f36
1 changed files with 5 additions and 0 deletions
|
@ -85,6 +85,11 @@ func GetTreeBySHA(ctx context.Context, repo *repo_model.Repository, gitRepo *git
|
|||
if entries[e].IsDir() {
|
||||
copy(treeURL[copyPos:], entries[e].ID.String())
|
||||
tree.Entries[i].URL = string(treeURL)
|
||||
} else if entries[e].IsSubModule() {
|
||||
// In Github Rest API Version=2022-11-28, if a tree entry is a submodule,
|
||||
// its url will be returned as an empty string.
|
||||
// So the URL will be set to "" here.
|
||||
tree.Entries[i].URL = ""
|
||||
} else {
|
||||
copy(blobURL[copyPos:], entries[e].ID.String())
|
||||
tree.Entries[i].URL = string(blobURL)
|
||||
|
|
Loading…
Reference in a new issue