プロジェクト

全般

プロフィール

Vote #78751

完了

URL-escape the ! character in generated markup for dropped uploads

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

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

0%

予定工数:
category_id:
26
version_id:
133
issue_org_id:
26682
author_id:
2784
assigned_to_id:
1
comments:
6
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

In #26071, we introduced the ability to just drag an image into a textbox and have Redmine generate the correct image markup for the uploaded file for easy inclusion.

Unfortunately, the @!@ character in the filename is not escaped here. Thus, when using Textile as the markup language and if the filename of the dropped file contains a @!@ character, the resulting markup will be invalid and the image will not be correctly referenced in the generated HTML.

The attached patch fixes this by explicitly percent-escaping the exclamation mark. While this step is not strictly required for markdown, it doesn't hurt there since the escaped version is strictly equivalent to the unescaped one for URLs.


journals

Confirmed the problem. Setting target version to 3.4.3.
Thank you for sharing the patch.

*Before:*
!{width: 280px; border: 1px solid #ccc;}.26682-before@2x.png!

*After:*
!{width: 280px; border: 1px solid #ccc;}.26682-after@2x.png!
--------------------------------------------------------------------------------
'(' and ')' have to be escaped for Markdown formatter.
Holger, would you update the patch to escape those characters?

!{width: 167px; border: 1px solid #ccc;}.parentheses@2x.png!
--------------------------------------------------------------------------------
Thank you for the review Maeda-san. I had a look at the Markdown generation but completely missed the parenthesis. In addition to that, it turns out that in my previous patch, only the first instance of an exclamation mark would have been escaped

The attached patch fixes both of these issues. It completely supersedes the previous patch.
--------------------------------------------------------------------------------
I have tested the updated patch (#26682#note-3). Now it works fine in both Markdown and Textile.
Thank you for updating the patch so quickly.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Patch committed, thanks.
--------------------------------------------------------------------------------


related_issues

relates,Closed,26071,Generate markup for uploaded image dropped into wiki-edit textarea

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

  • カテゴリText formatting_26 にセット
  • 対象バージョン3.4.3_133 にセット

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

いいね!0
いいね!0