forked from kevadesu/forgejo
Fix: return correct type in GetSubModule
- `GetSubModules` already solely stores the URL of the submodule and not a `*SubModule` entry, so don't try to type assert it to be a struct. - I am not able to pinpoint when this was regressed but if I had to guess it might be #4941. - Added integration test.
This commit is contained in:
parent
fe246cc060
commit
e7cffc378f
4 changed files with 46 additions and 12 deletions
|
@ -211,12 +211,12 @@ func GetContents(ctx context.Context, repo *repo_model.Repository, treePath, ref
|
|||
contentsResponse.Target = &targetFromContent
|
||||
} else if entry.IsSubModule() {
|
||||
contentsResponse.Type = string(ContentTypeSubmodule)
|
||||
submodule, err := commit.GetSubModule(treePath)
|
||||
submoduleURL, err := commit.GetSubModule(treePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if submodule != nil && submodule.URL != "" {
|
||||
contentsResponse.SubmoduleGitURL = &submodule.URL
|
||||
if submoduleURL != "" {
|
||||
contentsResponse.SubmoduleGitURL = &submoduleURL
|
||||
}
|
||||
}
|
||||
// Handle links
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue