summaryrefslogtreecommitdiffstats
path: root/lib/redmine/field_format.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-10-02 10:12:56 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-10-02 10:12:56 +0000
commitb5fddf0950188df54fbd1b9b7733f22c7f8f0bdd (patch)
tree44876e9490b984727f60b71be5df2bb37777749c /lib/redmine/field_format.rb
parent10ac3a9c8b614f1e4b09be21e62b08fe1b2159a2 (diff)
downloadredmine-b5fddf0950188df54fbd1b9b7733f22c7f8f0bdd.tar.gz
redmine-b5fddf0950188df54fbd1b9b7733f22c7f8f0bdd.zip
Merged r15846 (#23841).
git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@15868 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/field_format.rb')
-rw-r--r--lib/redmine/field_format.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb
index 6974e88ab..c59ca730e 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