aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository
diff options
context:
space:
mode:
Diffstat (limited to 'services/repository')
-rw-r--r--services/repository/files/tree.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/services/repository/files/tree.go b/services/repository/files/tree.go
index f4304ea630..0b1d304845 100644
--- a/services/repository/files/tree.go
+++ b/services/repository/files/tree.go
@@ -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)