diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-10-02 10:12:19 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-10-02 10:12:19 +0000 |
commit | c6e20372fd7a3711a87cd61cce6d232084955811 (patch) | |
tree | 3cb070a011f23f183387549f373d739c832580ac /lib | |
parent | 2f37af12252e3eb3349f133e55a944f06096d6c4 (diff) | |
download | redmine-c6e20372fd7a3711a87cd61cce6d232084955811.tar.gz redmine-c6e20372fd7a3711a87cd61cce6d232084955811.zip |
Merged r15846 (#23841).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@15867 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/field_format.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb index 0347ca8da..c7fcca987 100644 --- a/lib/redmine/field_format.rb +++ b/lib/redmine/field_format.rb @@ -202,19 +202,19 @@ module Redmine # %m1%, %m2%... => capture groups matches of the custom field regexp if defined def url_from_pattern(custom_field, value, customized) url = custom_field.url_pattern.to_s.dup - url.gsub!('%value%') {value.to_s} - url.gsub!('%id%') {customized.id.to_s} - url.gsub!('%project_id%') {(customized.respond_to?(:project) ? customized.project.try(:id) : nil).to_s} - url.gsub!('%project_identifier%') {(customized.respond_to?(:project) ? customized.project.try(:identifier) : nil).to_s} + url.gsub!('%value%') {URI.encode value.to_s} + url.gsub!('%id%') {URI.encode customized.id.to_s} + url.gsub!('%project_id%') {URI.encode (customized.respond_to?(:project) ? customized.project.try(:id) : nil).to_s} + url.gsub!('%project_identifier%') {URI.encode (customized.respond_to?(:project) ? customized.project.try(:identifier) : nil).to_s} if custom_field.regexp.present? url.gsub!(%r{%m(\d+)%}) do m = $1.to_i if matches ||= value.to_s.match(Regexp.new(custom_field.regexp)) - matches[m].to_s + URI.encode matches[m].to_s end end end - URI.encode(url) + url end protected :url_from_pattern |