[x]):The submodule link can only work when it's added at the project root directory. If the submodule is added in a directory then Gitea will fail to generate link.
Here is the repo with the submodule added at the "subdir" directory
https://try.gitea.io/jacktseng/submodule_at_subdir
Here is another branch in the same repo but with additional submodule added at root
https://try.gitea.io/jacktseng/submodule_at_subdir/src/branch/trick
You can find in the master branch Gitea doesn't generate the link for the submodule. But in the trick branch, Gitea can generate the link for both the submodule at root and for the one at "subdir".
...
The bug seems to be that it doesn't include the full path of the folder when checking to see if there is a matching entry in .gitmodules. It happens to work in the 2nd example because you've also added one at the top level and given them both the same name here, so subdir/sub_moduleRoot is actually just matching the also added path = sub_moduleRoot by coincidence since it is only searching for sub_moduleRoot.
Thank you for test case, hopefully PR should fix it.
Most helpful comment
The bug seems to be that it doesn't include the full path of the folder when checking to see if there is a matching entry in .gitmodules. It happens to work in the 2nd example because you've also added one at the top level and given them both the same name here, so
subdir/sub_moduleRootis actually just matching the also addedpath = sub_moduleRootby coincidence since it is only searching forsub_moduleRoot.Thank you for test case, hopefully PR should fix it.