プロジェクト

全般

プロフィール

Vote #80476

完了

Diff view for .js files in repositories is broken

Admin Redmine さんが約4年前に追加. 約4年前に更新.

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

0%

予定工数:
category_id:
3
version_id:
159
issue_org_id:
32449
author_id:
429887
assigned_to_id:
332
comments:
9
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
153
ステータス-->[Closed]

説明

When viewing a commit in the repository for a non-javascript file, clicking the diff link for that file opens the diff in the "view differences" tab on the same page.

When viewing a javascript file with a .js extension, clicking the diff link opens the snippet that would normally go in the "view differences" as a new page with no styling.

This is happening on our install across projects and consistently for all javascript files. Clicking on the "view differences" table for the javascript files instead of the diff link does display normally. It is easy to work around, by just using the show differences tab instead of the diff link.

Environment:
Redmine version 4.0.5.stable
Ruby version 2.6.3-p62 (2019-04-16) [x86_64-linux]
Rails version 5.2.3
Environment production
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery smtp
SCM:
Git 2.17.1


journals

We have the same problem with a GIT or SVN backend.

It looks like the page rendering crashes while building a DIFF of a Javascript file (something to do with syntax highlighting?).
All other file types seem ok:

Example :
https://source.scenari.software/projects/dev-core/repository/git/revisions/300fb80a966ae09c1ac7c8f7a8104a31dde93b72
The simple view of the Javascript file is ok :
https://source.scenari.software/projects/dev-core/repository/git/revisions/300fb80a966ae09c1ac7c8f7a8104a31dde93b72/entry/Wsp_Modeling/spaces/gen/modelBuilder/bs/_common/sm/webSiteGenerator/scDynUiMgr.js
But the diff view is not :
https://source.scenari.software/projects/dev-core/repository/git/revisions/300fb80a966ae09c1ac7c8f7a8104a31dde93b72/diff/Wsp_Modeling/spaces/gen/modelBuilder/bs/_common/sm/webSiteGenerator/scDynUiMgr.js

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

--------------------------------------------------------------------------------
Same with our Mercurial SCM.

h2. version 3.4.4.stable --> works fine

!{width: 70%}defect.32449-redmine_3.4.4.png!

h2. version 4.0.4.stable --> no styles and the menu disappears

!{width: 70%}defect.32449-redmine_4.0.4.png!
--------------------------------------------------------------------------------
When displaying the js file, base.html.erb was not used as the layout file.
Specifying an explicit layout file as shown below should solve the problem.

<pre><code class="diff">
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 269bc70a0..8350b4d48 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -269,7 +269,7 @@ class RepositoriesController < ApplicationController
@changeset = @repository.find_changeset_by_name(@rev)
@changeset_to = @rev_to ? @repository.find_changeset_by_name(@rev_to) : nil
@diff_format_revisions = @repository.diff_format_revisions(@changeset, @changeset_to)
- render :diff, :formats => :html
+ render :diff, :formats => :html, :layout => 'base.html.erb'
end
end
</code></pre>
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
After applying Mizuki ISHIKAWA's change and restarting Redmine, _View differences_ page works flawlessly with .js files.
--------------------------------------------------------------------------------
Setting the target version to 4.0.7.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Committed the patch. Thank you all for reporting and fixing this issue.
--------------------------------------------------------------------------------


related_issues

relates,Closed,30850,Unified diff link broken on specific file/revision diff view

Admin Redmine さんが約4年前に更新

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

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

いいね!0
いいね!0