Skip to content

Fix broken file browsing with a submodule that has a relative link

What does this MR do?

This MR fixes an error that occurs when browsing a submodule with a relative link.

Are there points in the code the reviewer needs to double check?

I re-wrote the function because I was confused by how the first one was supposed to work. Please review if it's clearer.

Why was this MR needed?

A 500 Error would occur when using the file browser on a repo with a submodule. Here's how to reproduce the bug:

  1. Start a new project in GitLab.
  2. Clone git://git.gniibe.org/gnuk/gnuk.git/ locally.
  3. Push repo to new project.
  4. Click on "Files" in the project.

The .gitmodules file:

[submodule "chopstx"]
        path = chopstx
        url = ../../chopstx/chopstx.git

What are the relevant issue numbers / Feature requests?

  1. #775 (closed)
  2. #1385 (closed)
  3. https://github.com/gitlabhq/gitlabhq/issues/8153
  4. https://github.com/gitlabhq/gitlabhq/issues/8881
  5. https://github.com/gitlabhq/gitlabhq/issues/7554

Merge request reports