diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-10-01 07:39:53 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-10-01 07:39:53 +0000 |
commit | 7abb92d8131c7efa7e33e2e33d0b478f781d8bad (patch) | |
tree | e0b5ce3664f67a281467c21c64284e5068fd93d9 /lib/redmine/field_format.rb | |
parent | 25b9ecd0ca8818034909e2d3c7096d15c2102ed7 (diff) | |
download | redmine-7abb92d8131c7efa7e33e2e33d0b478f781d8bad.tar.gz redmine-7abb92d8131c7efa7e33e2e33d0b478f781d8bad.zip |
Encode values, not full URL (#23841).
git-svn-id: http://svn.redmine.org/redmine/trunk@15846 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/field_format.rb')
-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 f6b120dc4..a1feed44a 100644 --- a/lib/redmine/field_format.rb +++ b/lib/redmine/field_format.rb @@ -209,19 +209,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 |