Project

General

Profile

Actions

Defect #2967

closed

Git revisions, diffs and entries not showing if filename has period in it.

Added by Marlin Forbes over 15 years ago. Updated over 15 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Category:
SCM
Target version:
-
Start date:
2009-03-13
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

I'm running r2580 of Redmine;
Rails 2.2.2
Ruby 1.8.6

I've had this problem before with svn, and now also with git, where many of the links in the repository browser show up as 404 Not Found.

I did some debugging in the source, and noticed that URLs where a period character is included were not being routed to the controller method.

This obviously poses a serious issue with URLs like the following (which pretty much everyone has):

http://example.org/projects/myfirstproject/repository/revisions/beb8242c47586e502cd96d9a33b74394d0927064/entry/somedir/somefile.php

I've tracked this down to a problem with ActionController, which wants to use the period as a separator for its .:format modifier. I see you are using that in the controller, but the controller never gets called because the router doesn't recognize it for that controller.

While going through the code, I also noticed an obvious error in config/routes.rb. Lines 212 - 221 used to read repositories.connect, instead of the scoped repository_views.connect.

210   map.with_options :controller => 'repositories' do |repositories|
211     repositories.with_options :conditions => {:method => :get} do |repository_views|
212       repository_views.connect 'projects/:id/repository', :action => 'show'
213       repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
214       repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
215       repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
216       repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
217       repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
218       repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
219       repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
220       repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path'
221       repository_views.connect 'projects/:id/repository/:action/*path'
222     end
Actions #2

Updated by Jean-Philippe Lang over 15 years ago

If you get 404 when trying to view a .php file, you should have a look at this FAQ item.
There's no .:format modifier when a repository path is included in the url.

While going through the code, I also noticed an obvious error in config/routes.rb.

Fixed in r2581. A few changes in views were needed too.

Actions #3

Updated by Marlin Forbes over 15 years ago

Jean-Philippe Lang wrote:

If you get 404 when trying to view a .php file, you should have a look at this FAQ item.

I've implemented the changes on that page, and see no change in the behaviour of the system. I cannot view other extensions either, for example, .gitignore...

There's no .:format modifier when a repository path is included in the url.

I think it maybe chops it off regardless.

Is this something specific to the version of Rails I'm using I wonder? Does the main site use 2.2.2?

The only thing I can think of which might help is the use of :requirements, but I'm thinking that isn't used for *path parameters.

While going through the code, I also noticed an obvious error in config/routes.rb.

Fixed in r2581. A few changes in views were needed too.

Thanks, quick work. :)

Actions #4

Updated by Marlin Forbes over 15 years ago

When I request this url:

http://example.org/projects/project/repository/revisions/26efa886b202b3dc89d75ae934761c355b0353e6/entry/httpdocs/frontend/_assets/ssi/navigation.php

I get this in the log:

Processing RepositoriesController#revision (for 196.209.169.20 at 2009-03-13 20:44:55) [GET]
Parameters: {"rev"=>"26efa886b202b3dc89d75ae934761c355b0353e6", "action"=>"revision", "id"=>"iprop", "controller"=>"repositories"}
Rendering template within layouts/base
Rendering repositories/revision
Completed in 102ms (View: 64, DB: 18) | 200 OK [http://example.org/projects/iprop/repository/revisions/26efa886b202b3dc89d75ae934761c355b0353e6]

and this is in the error log:

[Fri Mar 13 20:44:58 2009] [error] [client 196.209.169.20] File does not exist: /usr/local/www/vhosts/example.org/subdomains/issues/httpdocs/public/projects, referer: http://example.org/projects/iprop/repository/revisions/26efa886b202b3dc89d75ae934761c355b0353e6

It looks as if something's not right with the route parsing...

Actions #5

Updated by Marlin Forbes over 15 years ago

I have put debug code into the controller methods and they are not called at all. I have a wrapper around git which logs the parameters to a text file, so I can see what commands are being run, and when I hit those URLs, no command is run, which figures since the controller method is not reached.

Actions #6

Updated by Marlin Forbes over 15 years ago

Oops, if you can edit my log entries there, I'd appreciate taking out the hostnames...

Actions #7

Updated by Jean-Philippe Lang over 15 years ago

Oops, if you can edit my log entries there, I'd appreciate taking out the hostnames...

Done

and this is in the error log

Is it the apache (or any other webserver) error log?
If so, the 404 is sent by apache and thus the application doesn't even see the request. And that's why your debug code in the controller is not reached.

Obviously, Redmine knows how to serve a repository file with a dot in its name. So I think you really have some kind of configuration on your web server that prevents these requests to be handled by the application.

Actions #8

Updated by Marlin Forbes over 15 years ago

Jean-Philippe Lang wrote:

Obviously, Redmine knows how to serve a repository file with a dot in its name. So I think you really have some kind of configuration on your web server that prevents these requests to be handled by the application.

I figured it out! I was using the SCGI controller from Zed Shaw to serve Redmine.

I had a look at the recommended configuration, and found a LocationMatch directive which was routing URLs with extensions to Apache so as to serve them directly.

Sorry for wasting your time, hope this at least helps someone else figure this out.

I have now moved onto Passenger, much easier to setup...

Actions #9

Updated by Marlin Forbes over 15 years ago

  • Status changed from New to Resolved
Actions #10

Updated by Marlin Forbes over 15 years ago

Can you double-check that the routing changes that you've made in r2581 have not broken the ability to delete an existing repository? I'm getting a method not allowed error, and I suspect it's caused by changing the scoping of the repository URLs.

Processing RepositoriesController#edit (for 196.209.169.20 at 2009-03-14 10:29:20) [POST]
Parameters: {"commit"=>"Save", "action"=>"edit", "id"=>"iprop", "controller"=>"repositories"}
Completed in 19ms (View: 6, DB: 1) | 200 OK [http://issues.nexsys.co.za/projects/iprop/repository/edit]

Processing ApplicationController#index (for 196.209.169.20 at 2009-03-14 10:29:41) [POST]

ActionController::MethodNotAllowed (Only get requests are allowed.):
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/recognition_optimisation.rb:64:in `recognize_path'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/route_set.rb:386:in `recognize'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:182:in `handle_request'

...

Actions #11

Updated by Marlin Forbes over 15 years ago

I was able to delete the repository by manually browsing to the repository destroy URL, using a GET request. This is probably not a good thing - idempotency issues...

Actions #12

Updated by Marlin Forbes over 15 years ago

Eeek, can't update committers either...

POSTing to

http://example.org/projects/project/repository/committers

yields the same blank screen, and an error about method not allowed.

Actions #13

Updated by Jean-Philippe Lang over 15 years ago

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

Thanks for your feedback concerning your LocationMatch directive.
Routes are fixed in r2590.

Actions

Also available in: Atom PDF