Failure to delete a blob from the Web UI causes an Error 500
It looks like if there is some failure in deleting a blob from the Web UI, the failure_view gets directed to :show, which expects @last_commit to be defined. Since it isn't in the destroy, Rails bombs out with an Error 500 without more details of why the file was unable to delete.
Backtrace:
Started GET "/" for 208.x.x.x at 2017-08-23 08:45:44 +0000
Processing by RootController#index as HTML
Redirected to https://git.domain.com/users/sign_in
Filter chain halted as :redirect_unlogged_user rendered or redirected
Completed 302 Found in 8ms (ActiveRecord: 0.3ms | Elasticsearch: 0.0ms)
Started GET "/users/sign_in" for 208.83.104.114 at 2017-08-23 08:45:44 +0000
Completed 200 OK in 239ms (Views: 177.4ms | ActiveRecord: 6.1ms | Elasticsearch: 0.0ms)
Processing by SessionsController#new as HTML
Completed 200 OK in 565ms (Views: 3.9ms | ActiveRecord: 247.7ms | Elasticsearch: 0.0ms)
Completed 500 Internal Server Error in 342ms (ActiveRecord: 81.0ms | Elasticsearch: 0.0ms)
ActionView::Template::Error (undefined method `notes' for nil:NilClass):
2: - if @note_counts
3: - note_count = @note_counts.fetch(commit.id, 0)
4: - else
5: - notes = commit.notes
6: - note_count = notes.user.count
7:
8: - cache_key = [project.path_with_namespace, commit.id, current_application_settings, note_count]
app/views/projects/commits/_commit.html.haml:5:in `_app_views_projects_commits__commit_html_haml___2930178901016895835_70077225104800'
app/views/projects/blob/_blob.html.haml:6:in `_app_views_projects_blob__blob_html_haml__4286486454230938797_70077139951540'
app/views/projects/blob/show.html.haml:13:in `_app_views_projects_blob_show_html_haml__2050529324324153799_70077128158800'
app/controllers/concerns/creates_commit.rb:39:in `block (2 levels) in create_commit'
app/controllers/concerns/creates_commit.rb:36:in `create_commit'
app/controllers/projects/blob_controller.rb:85:in `destroy'
lib/gitlab/i18n.rb:39:in `with_locale'
lib/gitlab/i18n.rb:45:in `with_user_locale'
app/controllers/application_controller.rb:307:in `set_locale'
lib/gitlab/performance_bar/peek_performance_bar_with_rack_body.rb:16:in `call'
lib/gitlab/middleware/multipart.rb:93:in `call'
lib/gitlab/request_profiler/middleware.rb:14:in `call'
lib/gitlab/middleware/go.rb:16:in `call'
lib/gitlab/etag_caching/middleware.rb:11:in `call'
lib/gitlab/middleware/readonly_geo.rb:30:in `call'
lib/gitlab/request_context.rb:18:in `call'
Zendesk: https://gitlab.zendesk.com/agent/tickets/81606
/cc: @DouweM
Edited by 🤖 GitLab Bot 🤖