プロジェクト

全般

プロフィール

Vote #79854

完了

Unified diff link broken on specific file/revision diff view

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
SCM_3
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
3
version_id:
151
issue_org_id:
30850
author_id:
90398
assigned_to_id:
1
comments:
12
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
145
ステータス-->[Closed]

説明

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.


journals

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

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

<pre><code class="diff">
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

</code></pre>

--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
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?
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------

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

--------------------------------------------------------------------------------


related_issues

relates,Closed,31141,SCM: error when *.yml and *.txt show
relates,Closed,32449,Diff view for .js files in repositories is broken

Admin Redmine さんが3年以上前に更新

  • カテゴリSCM_3 にセット
  • 対象バージョン4.0.4_151 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0