Crash on access of commit containing submodule update when submodule's URL is relative
On opening URL of commit in master repository, containing update of submodule, GitLab crashes with the following call stack:
Started GET "/android/ndk/commit/4caf76079f481be208610891d5a7c3e530154fcb" for 213.21.30.59 at 2015-04-06 22:51:39 +0300
Processing by Projects::CommitController#show as HTML
Parameters: {"namespace_id"=>"android", "project_id"=>"ndk", "id"=>"4caf76079f481be208610891d5a7c3e530154fcb"}
Completed 500 Internal Server Error in 263ms
ActionView::Template::Error (undefined method `namespace' for "android/vendor-p7zip":String):
11: = view_file_btn(@commit.parent_id, diff_file, project)
12: - elsif diff_file.diff.submodule?
13: - submodule_item = project.repository.blob_at(@commit.id, diff_file.file_path)
14: = submodule_link(submodule_item, @commit.id)
15: - else
16: - if diff_file.renamed_file
17: %span= "#{diff_file.old_path} renamed to #{diff_file.new_path}"
app/helpers/submodule_helper.rb:61:in `relative_self_links'
app/helpers/submodule_helper.rb:19:in `submodule_links'
app/helpers/diff_helper.rb:140:in `submodule_link'
app/views/projects/diffs/_file.html.haml:14:in `_app_views_projects_diffs__file_html_haml__3748709080662235229_69893827901800'
app/views/projects/diffs/_diffs.html.haml:14:in `block in _app_views_projects_diffs__diffs_html_haml__450668626915461673_69893839919140'
app/views/projects/diffs/_diffs.html.haml:13:in `each'
app/views/projects/diffs/_diffs.html.haml:13:in `each_with_index'
app/views/projects/diffs/_diffs.html.haml:13:in `_app_views_projects_diffs__diffs_html_haml__450668626915461673_69893839919140'
app/views/projects/commit/show.html.haml:2:in `_app_views_projects_commit_show_html_haml__4135917334712515910_69893850592420'
app/controllers/projects/commit_controller.rb:25:in `show'
Here "android/ndk" is master repository, and "android/vendor-p7zip" is submodule. This submodule is actually referenced by relative URL in master repository - i.e. it's URL in .gitmodules is "../vendor-p7zip.git". Don't know if that matter, but thought it would be good to mention.