Self-hosted submodules with relative url "./" have broken links in Repository browser
Summary
When browsing a Project with certain submodules, clicking on a submodule entry in the Repository browser can give a 404 error.
Steps to reproduce
- Browse to this Project: https://gitlab.com/abliss/bugdemo/tree/c65fb34347fc722dcc3874cafc1b5ca6628f2198
- Click on the "submodule @ 0c0e9837" entry.
What is the current bug behavior?
The browser location changes to https://gitlab.com/abliss/bugdemo/tree/ , which is a 404. (Additionally, if you are not signed in, this link asks you to sign in, even though the repo is public.)
What is the expected correct behavior?
In this case, because the url for the submodule is "./", the desired commit (0c0e9837) is actually available for browsing in the present Project. So I would like the link to instead take me to: https://gitlab.com/abliss/bugdemo/tree/0c0e9837
Output of checks
This bug happens on GitLab.com
Possible fixes
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/helpers/submodule_helper.rb#L47
I believe that "./" is a valid relative-url for a submodule (it causes the submodule's objects to be stored in the same repo as the parent repo.) Fixing up this regex (and the relative_self_links) should be enough to allow this to work correctly.