プロジェクト

全般

プロフィール

Vote #77245

完了

Text in the "removed" part of a wiki diff is double-escaped

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

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

0%

予定工数:
category_id:
10
version_id:
110
issue_org_id:
22115
author_id:
3866
assigned_to_id:
1
comments:
5
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

In a wiki diff (and from the looks of the code the diffs of issue description) html special characters in the deleted parts are double-escaped.


journals

The attached diff adds a test and a diff for this behaviour.

The problem is in source:/trunk/lib/redmine/helpers/diff.rb@15153: the string @deleted@ is concatenated from unsafe strings (lines 46 and 55) and an html escaped string (line 56) and thus html unsafe. It then is added @+@ to an @html_safe@ string in line 65, which causes @deleted@ to be html escaped a second time before being concatenated to the string on the left hand of the @+@.

The patch moves the explicit html escape to line 65 and keeps the explicit html escape to avoid problems with the implicit html escaping performed by the addition @+@ to a @html_safe@ string.
--------------------------------------------------------------------------------
Felix Schäfer wrote:
> The patch moves the explicit html escape to line 65 and keeps the explicit html escape to avoid problems with the implicit html escaping performed by the addition @+@ to a @html_safe@ string.

Ah, and the @.join(' ').html_safe@ at the end is replaced with the safer @safe_join@ which ensures any non-@html_safe@ string in the array is html escaped before concatenation.
--------------------------------------------------------------------------------
@safe_join@ comes from an @ActionView::Helper@ that wasn't included yet in @Redmine::Helpers::Diff@, this patch corrects this omission.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Committed, thanks.
--------------------------------------------------------------------------------

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

  • カテゴリUI_10 にセット
  • 対象バージョン3.3.0_110 にセット

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

いいね!0
いいね!0