Redirect projects/:id to project page returns 500 error
Summary
Whenm attempting to go to the projects/:id endpoint to be redirected to the GitLab Project page, the page instead returns a 500 error.
Steps to reproduce
Try to go to https://gitlab.com/projects/278964. You should be redirected to https://gitlab.com/gitlab-org/gitlab.
- This returns a 500 error in Chrome 97. (Both when logged into GitLab, and not logged in)
- Strangely,
curlseems to be fine:
$ curl https://gitlab.com/projects/278964
<html><body>You are being <a href="https://gitlab.com/gitlab-org/gitlab">redirected</a>.</body></html>
$ curl -L https://gitlab.com/projects/278964
<Returns correct HTML page>
What is the current bug behavior?
- A 500 error.
What is the expected correct behavior?
- To be redirected to the project page.
Relevant logs and/or screenshots
Links are for internal use only
Kibana Link: https://log.gprd.gitlab.net/goto/0613d1c0-7d84-11ec-a649-b7cbb8e4f62e
https://sentry.gitlab.net/gitlab/gitlabcom/issues/3161532/?referrer=gitlab_plugin
TypeError: no implicit conversion of nil into String
app/controllers/projects/application_controller.rb:26:in `join'
path = File.join(params[:namespace_id], params[:project_id] || params[:id])
app/controllers/projects/application_controller.rb:26:in `project'
path = File.join(params[:namespace_id], params[:project_id] || params[:id])
app/controllers/concerns/sourcegraph_decorator.rb:34:in `sourcegraph_enabled_for_project?'
return false unless project && Gitlab::Sourcegraph.feature_enabled?(project)
app/controllers/concerns/sourcegraph_decorator.rb:30:in `sourcegraph_enabled?'
Gitlab::CurrentSettings.sourcegraph_enabled && sourcegraph_enabled_for_project? && current_user&.sourcegraph_enabled
app/controllers/concerns/sourcegraph_decorator.rb:22:in `push_sourcegraph_gon'
return unless sourcegraph_enabled?
...
(149 additional frame(s) were not displayed)
Possible fixes
- Possibly related to this MR that fixed the sourcegraph integration?
- Original code from gitlab-foss!24467 (diffs)
Edited by Kenneth Chu