I'm looking for a part-time remote job.

Hire me


I'm the author of:

Mastering Redmine is a comprehensive guide with tips, tricks and best practices, and an easy-to-learn structure.

Check the book's project or

Buy the book

Social pages of the book:

By buying this book you also donate to Redmine (see this page).


Follow me:

Bug #2408

Bug #2378: Compatibility to Redmine 3.0.1

Redmine 2.5.xd fails to find project by aliases

Added by Andriy Lesyuk over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Major
Assignee:
Target version:
Start date:
Due date:
% Done:

100%

Redmine version:
2.5.xd
External issue:

Description

ApplicationController uses the find_project method, which in turn uses Project.find, to find projects. For some reason, this way Redmine succeeds to find aliased projects on my local installation, but fails to do this on the server.

This caused multiple exceptions, e.g., when Redmine tried to access .wiki of null. Therefore, in ApplicationController#find_project method I replaced find with the patched find_by_identifier:

  # Find project of id params[:id]
  def find_project
    @project = Project.find_by_identifier(params[:id]) # <-- here
  rescue ActiveRecord::RecordNotFound
    render_404
  end

But, this is a temporary fix, that should be reverted!

Even so, Redmine still randomly fails to find the project and gives 403:

Started GET "/projects/redmine-svn" for **.***.***.*** at 2016-10-02 10:46:23 +0000
Processing by ProjectsController#show as HTML
  Parameters: {"id"=>"redmine-svn"}
  Current user: s-andy (id=1)
  Rendered common/error.html.erb within layouts/base (0.5ms)
  Rendered inline template (1.3ms)
  Rendered plugins/download/app/views/download/_sidebar.html.erb (0.1ms)
  Rendered plugins/subscription/app/views/subscribe/_sidebar.html.erb (0.1ms)
  Rendered plugins/download/app/views/download/_warning.html.erb (0.1ms)
  Rendered plugins/like/app/views/like/_base.html.erb (0.2ms)
  Rendered plugins/redpress/app/views/red_press/_wordpress.html.erb (0.1ms)
Filter chain halted as :authorize rendered or redirected
Completed 403 Forbidden in 573ms (Views: 531.5ms | ActiveRecord: 32.9ms)

There are also other issues like:

Started GET "/projects/redmine-download/issues?per_page=50&priority_id=5&set_filter=1&sort=votes_value%2Csubject%3Adesc%2Cfixed_version&subproject_id=%21%2A" for ***.***.***.*** at 2016-10-02 10:46:24 +0000
Processing by IssuesController#index as */*
  Parameters: {"per_page"=>"50", "priority_id"=>"5", "set_filter"=>"1", "sort"=>"votes_value,subject:desc,fixed_version", "subproject_id"=>"!*", "project_id"=>"redmine-download"}
  Current user: anonymous
  Rendered common/error.html.erb within layouts/base (0.4ms)
  Rendered inline template (1.3ms)
  Rendered plugins/download/app/views/download/_sidebar.html.erb (0.1ms)
  Rendered plugins/download/app/views/download/_warning.html.erb (0.1ms)
  Rendered plugins/like/app/views/like/_base.html.erb (0.2ms)
  Rendered plugins/redpress/app/views/red_press/_wordpress.html.erb (0.1ms)
Filter chain halted as :find_optional_project rendered or redirected
Completed 404 Not Found in 60ms (Views: 48.3ms | ActiveRecord: 3.3ms)

The find_optional_project method also calls Project.find...


Related issues

Related to Projects - Improvement #2409: Upgrade to Redmine 2.5.xd Closed

Associated revisions

Revision 21 (diff)
Added by Andriy Lesyuk over 4 years ago

Do not call super in patched finder (fixes #2408)

History

#1 Updated by Andriy Lesyuk over 4 years ago

#2 Updated by Andriy Lesyuk over 4 years ago

Hm... Project.find calls Project.find_by_identifier, so everything should have worked...

#3 Updated by Andriy Lesyuk over 4 years ago

Looks like, this happens, because in super, which is called from find_by_identifier, Rails overrides find_by_identifier. This explains, why the issue comes up “randomly”.

Also, looks like this bug is present in Rails 2.1.5-p273, but not in Rails 2.3.1-p112.

#4 Updated by Anonymous over 4 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r21.

Also available in: Atom PDF

Terms of use | Privacy policy