Defect #4377

Error 500 when viewing revision

Added by Erwane Breton about 11 years ago. Updated about 11 years ago.

Status:ClosedStart date:2009-12-10
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:SCM
Target version:-
Resolution:Fixed Affected version:

Description

Hi, sometime i've got an error code 500 when viewing a special revision.
This append when a forum/website/twitter or other support create a direct link to the revision and when i've not visit the redmine for a time (10 minutes)

script/about

About your application's environment
Ruby version              1.8.7 (i386-freebsd6)
RubyGems version          1.3.5
Rack version              1.0
Rails version             2.3.4
Active Record version     2.3.4
Active Resource version   2.3.4
Action Mailer version     2.3.4
Active Support version    2.3.4
Application root          /exports/www/coda-cola.net/phpbb-seo
Environment               production
Database adapter          mysql
Database schema version   20091114105931

the link
http://phpbb-seo.coda-cola.net/projects/phpbb_seo_premod/repository/revisions/201

And the production.log for this error

Processing RepositoriesController#revision (for xxx.xxx.xxx.xxx at 2009-12-10 17:28:17) [GET]
  Parameters: {"rev"=>"201", "action"=>"revision", "id"=>"phpbb_seo_premod", "controller"=>"repositories"}
Rendering template within layouts/base
Rendering repositories/revision

ActionView::TemplateError (can't convert nil into String) on line #51 of app/views/repositories/revision.rhtml:
48: <p><%= link_to(l(:label_view_diff), :action => 'diff', :id => @project, :path => "", :rev => @changeset.revision) if @changeset.changes.any? %></p>
49:
50: <div class="changeset-changes">
51: <%= render_changeset_changes %>
52: </div>
53: <% end %>
54:

    app/models/repository/subversion.rb:87:in `escape'
    app/models/repository/subversion.rb:87:in `relative_url'
    app/models/repository/subversion.rb:40:in `relative_path'
    app/helpers/repositories_helper.rb:88:in `render_changes_tree'
    app/helpers/repositories_helper.rb:78:in `each'
    app/helpers/repositories_helper.rb:78:in `render_changes_tree'
    app/helpers/repositories_helper.rb:103:in `render_changes_tree'
    app/helpers/repositories_helper.rb:78:in `each'
    app/helpers/repositories_helper.rb:78:in `render_changes_tree'
    app/helpers/repositories_helper.rb:103:in `render_changes_tree'
    app/helpers/repositories_helper.rb:78:in `each'
    app/helpers/repositories_helper.rb:78:in `render_changes_tree'
    app/helpers/repositories_helper.rb:103:in `render_changes_tree'
    app/helpers/repositories_helper.rb:78:in `each'
    app/helpers/repositories_helper.rb:78:in `render_changes_tree'
    app/helpers/repositories_helper.rb:103:in `render_changes_tree'
    app/helpers/repositories_helper.rb:78:in `each'
    app/helpers/repositories_helper.rb:78:in `render_changes_tree'
    app/helpers/repositories_helper.rb:70:in `render_changeset_changes'
    app/views/repositories/revision.rhtml:51:in `_run_rhtml_app47views47repositories47revision46rhtml'
    app/controllers/repositories_controller.rb:138:in `revision'
    /www/coda-cola.net/phpbb-seo/public/dispatch.fcgi:5

Rendering /exports/www/coda-cola.net/phpbb-seo/public/500.html (500 Internal Server Error)

if i surf into the redmine, look for revision and re-put the link, it's work.

Thanks.

Associated revisions

Revision 3158
Added by Jean-Philippe Lang about 11 years ago

Retrieve root_url if needed (#4377).

History

#1 Updated by Jean-Philippe Lang about 11 years ago

Do you have a cron job or something that resets your Redmine repository periodically?
Can you try this patch:

Index: app/models/repository/subversion.rb
===================================================================
--- app/models/repository/subversion.rb    (revision 3138)
+++ app/models/repository/subversion.rb    (working copy)
@@ -84,6 +84,6 @@
   #     url      = file:///var/svn/foo/bar
   #     => returns /bar
   def relative_url
-    @relative_url ||= url.gsub(Regexp.new("^#{Regexp.escape(root_url)}", Regexp::IGNORECASE), '')
+    @relative_url ||= url.gsub(Regexp.new("^#{Regexp.escape(root_url || scm.root_url)}", Regexp::IGNORECASE), '')
   end
 end

#2 Updated by Erwane Breton about 11 years ago

You're right. my cronjob reset the "root_url" field to NULL. I'll remove this.

The root_url field is the real svn root ?
ex i can define url field to http://svn.domaine.tld/my-project/trunk
and root_url should be http://svn.domaine.tld/my-project

That's it ?

Thanks

#3 Updated by Jean-Philippe Lang about 11 years ago

Erwane Breton wrote:

You're right. my cronjob reset the "root_url" field to NULL. I'll remove this.

Why do you do that?

#4 Updated by Erwane Breton about 11 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

I hope this don't hurt you :)

I have lots of redmine for my clients, and i don't want they change the url (because i host SVN to).
So i check periodically if the data in "repositories" table is good and if not, i update datas.

I've just don't understand the utility of root_url, so put to NULL, now i don't change this field and all work well.

#5 Updated by Jean-Philippe Lang about 11 years ago

  • Category set to SCM
  • Status changed from Resolved to Closed
  • Resolution set to Fixed

Also available in: Atom PDF