プロジェクト

全般

プロフィール

Vote #79722

完了

Cannot make cross-project wiki link if the project name includes square brackets

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

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

0%

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

説明

According to the Wiki formatting help, You can link to wiki pages of another project using the following syntax.

[[sandbox:some page]]
[[sandbox:]]

However, it does not work if the name of the destination project includes "[" or "]" character.

For example, suppose that there is a project named "[Foo]Bar". If you want to link to wiki pages in the project, the syntax is "[[[Foo]Bar:PageName]]". However, it does not generate any link.

!{width: 387px; border: 1px solid #ccc;}.screenshot@2x.png!


journals

--------------------------------------------------------------------------------
I reviewed the regular expression as follows.(Change from "greedy quantifier" to "lazy quantifier")
https://ruby-doc.org/core-2.6/doc/regexp_rdoc.html#label-Repetition
I attached a patch.
<pre><code class="diff">
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e250c20ee..8fa56ac55 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -787,7 +787,7 @@ module ApplicationHelper
# [[project:mypage]]
# [[project:mypage|mytext]]
def parse_wiki_links(text, project, obj, attr, only_path, options)
- text.gsub!(/(!)?(\[\[([^\]\n\|]+)(\|([^\]\n\|]+))?\]\])/) do |m|
+ text.gsub!(/(!)?(\[\[([^\n\|]+?)(\|([^\n\|]+?))?\]\])/) do |m|
link_project = project
esc, all, page, title = $1, $2, $3, $5
if esc.nil?
</code></pre>

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

--------------------------------------------------------------------------------
LGTM. Setting the target version to 4.0.3.
--------------------------------------------------------------------------------
Committed the patch. Thank you for your contribution.
--------------------------------------------------------------------------------

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


related_issues

relates,New,20397,project:someproject wiki syntax should link to project with identifier "someproject', not name.

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

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

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

いいね!0
いいね!0