Bug #192

500 on unauthorized access to repository view

Added by Gregor Schmidt 6 months ago. Updated 6 months ago.

Status:Completed and Comitted Start date:2011-12-07
Priority:Normal Due date:
Assignee:Holger Just % Done:

100%

Category:-
Target version:0.6 Release
Resolution:Fixed

Description

When trying to access a repository view of I project, where I do not have sufficient permissions, I am getting a 500 with the following stack trace.

The attached patch fixes this error and adds a test as well.

Processing RepositoriesController#changes (for ... at 2011-12-07 09:04:56) [GET]
  Parameters: {"action"=>"changes", "id"=>"...", "path"=>[...], "controller"=>"repositories"}
Rendering template within layouts/base
Rendering common/error (403)

ActionView::TemplateError (undefined method `repository' for nil:NilClass) on line #5 of vendor/plugins/redmine_checkout/app/views/common/error.html.erb:
2: 
3: <p id="errorExplanation"><%=h @message %></p>
4: <% if params[:controller] == "repositories" %>
5: <%= call_hook(:view_repositories_show_contextual, { :repository => @project.repository, :project => @project }) %>
6: <% end %>
7: <p><a href="javascript:history.back()">Back</a></p>
8: 

    vendor/plugins/redmine_checkout/app/views/common/error.html.erb:5
    app/controllers/application_controller.rb:306:in `render_error'
    app/controllers/application_controller.rb:304:in `render_error'
    app/controllers/application_controller.rb:287:in `render_403'
    app/controllers/application_controller.rb:159:in `deny_access'
    app/controllers/application_controller.rb:171:in `authorize'

fix_error_handling.diff (1.3 kB) Gregor Schmidt, 2011-12-07 17:52

Associated revisions

Revision 212
Added by Holger Just 6 months ago

[#192] Check if there is a @project on repository error pages.

Patch contributed by Gregor Schmidt.

History

Updated by Holger Just 6 months ago

  • Target version set to 0.6 Release
  • % Done changed from 0 to 100
  • Resolution set to Fixed
  • Status changed from Open to Completed and Comitted

Committed in r212. Thanks for your patch!

Also available in: Atom PDF