diff options
author | Go MAEDA <maeda@farend.jp> | 2023-04-21 03:06:06 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2023-04-21 03:06:06 +0000 |
commit | b1510836b066ecb6dd6da9d9553ba4643bb6661b (patch) | |
tree | 1c8bd12becdf15f35e815e7a0c2e24ba037e0a89 /lib | |
parent | 109962363437a7f5e9f724059a657f96dbe5de64 (diff) | |
download | redmine-b1510836b066ecb6dd6da9d9553ba4643bb6661b.tar.gz redmine-b1510836b066ecb6dd6da9d9553ba4643bb6661b.zip |
Rendering a custom field with a URL pattern set and containing " :" in the value raises Addressable::URI::InvalidURIError (#38464).
Patch by Go MAEDA.
git-svn-id: https://svn.redmine.org/redmine/trunk@22205 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/field_format.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb index e74dc20d7..a27311141 100644 --- a/lib/redmine/field_format.rb +++ b/lib/redmine/field_format.rb @@ -276,15 +276,15 @@ 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%') {Addressable::URI.encode value.to_s} - url.gsub!('%id%') {Addressable::URI.encode customized.id.to_s} + url.gsub!('%value%') {Addressable::URI.encode_component value.to_s} + url.gsub!('%id%') {Addressable::URI.encode_component customized.id.to_s} url.gsub!('%project_id%') do - Addressable::URI.encode( + Addressable::URI.encode_component( (customized.respond_to?(:project) ? customized.project.try(:id) : nil).to_s ) end url.gsub!('%project_identifier%') do - Addressable::URI.encode( + Addressable::URI.encode_component( (customized.respond_to?(:project) ? customized.project.try(:identifier) : nil).to_s ) end @@ -292,7 +292,7 @@ module Redmine url.gsub!(%r{%m(\d+)%}) do m = $1.to_i if matches ||= value.to_s.match(Regexp.new(custom_field.regexp)) - Addressable::URI.encode matches[m].to_s + Addressable::URI.encode_component matches[m].to_s end end end |