Project

General

Profile

Actions

Defect #30850

closed

Unified diff link broken on specific file/revision diff view

Defect #30850: Unified diff link broken on specific file/revision diff view

Added by Anthony Mallet almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Category:
SCM
Target version:
Resolution:
Fixed
Affected version:

Description

Clicking on the "Unified diff" link at the bottom of a diff page of a specific revision doesn't work anymore.

For a git revision, it simply produces a "Page not found" error.

Url are like 'https://.../projects/:project_id/repository/:repository_id/revisions/:rev/diff.diff, the last component is interpreted as a (/*path) according to routes.rb (lines 250 and 258)

This was fixed in issue #11325 (revision 9909), but was broken in 4.0.1 again.


Related issues 2 (0 open — 2 closed)

Related to Redmine - Defect #31141: SCM: error when *.yml and *.txt showClosedActions
Related to Redmine - Defect #32449: Diff view for .js files in repositories is brokenClosedGo MAEDAActions

Updated by Go MAEDA almost 8 years ago Actions #1

  • Status changed from New to Confirmed

Updated by Go MAEDA almost 8 years ago Actions #2

  • Target version set to 4.0.2

Updated by Jean-Philippe Lang almost 8 years ago Actions #3

  • Target version changed from 4.0.2 to 4.0.3

Updated by Mizuki ISHIKAWA over 7 years ago Actions #4

By changing to the following, the diff format is allowed.

diff --git a/config/routes.rb b/config/routes.rb
index 0344982085..07287f208d 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -250,7 +250,7 @@ Rails.application.routes.draw do
     get "projects/:id/repository/:repository_id/revisions/:rev/#{action}(/*path)",
         :controller => 'repositories',
         :action => action,
-        :format => 'html',
+        :format => (action == 'diff' ? /(html|diff)/ : 'html'),
         :constraints => {:rev => /[a-z0-9\.\-_]+/, :path => /.*/}
   end

@@ -258,7 +258,7 @@ Rails.application.routes.draw do
     get "projects/:id/repository/:repository_id/#{action}(/*path)",
         :controller => 'repositories',
         :action => action,
-        :format => 'html',
+        :format => (action == 'diff' ? /(html|diff)/ : 'html'),
         :constraints => {:path => /.*/}
   end

Updated by Jean-Philippe Lang over 7 years ago Actions #5

Mizuki ISHIKAWA wrote:

By changing to the following, the diff format is allowed.

[...]

This change doesn't work when trying to get the diff of a single file of a revision, eg:
/projects/projet-a/repository/svn2/revisions/10/diff/subversion_test/folder/subfolder/journals_controller.rb.diff => 404 not found

Updated by Jean-Philippe Lang over 7 years ago Actions #6

  • Status changed from Confirmed to Resolved

Fix committed in r17962 by restoring :format => false just like it was in 3.4.
This was changed when upgrading to Rails 5 because :format => false was no longer working a sexpected, I suspect that a Rails regression was fixed lately.
I've also added some integration tests to make sure that browsing diffs no longer breaks.

Just in case, could anyone confirm this is fixed?

Updated by Jean-Philippe Lang over 7 years ago Actions #7

  • Status changed from Resolved to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Updated by Go MAEDA over 7 years ago Actions #8

  • Related to Defect #31141: SCM: error when *.yml and *.txt show added

Updated by Go MAEDA over 7 years ago Actions #9

  • Status changed from Closed to Reopened
  • Target version changed from 4.0.3 to 4.0.4

The fix in r17962 caused another problem #31141.

And there is another problem regarding this issue. Although the target version is 4.0.3, the change has not merged to 4.0-stable branch. I am reopening this issue and change the target version to 4.0.4.

Updated by Toshi MARUYAMA over 7 years ago Actions #10

  • Description updated (diff)

Updated by Jean-Philippe Lang over 7 years ago Actions #11

  • Status changed from Reopened to Closed

Merged to 4.0-stable, thanks for digging into this!

Updated by Go MAEDA almost 7 years ago Actions #12

  • Related to Defect #32449: Diff view for .js files in repositories is broken added
Actions

Also available in: PDF Atom