From: Jean-Philippe Lang Date: Sat, 18 Jun 2016 10:16:43 +0000 (+0000) Subject: Merged r15539 and r15550 (#23067). X-Git-Tag: 3.3.0~12 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=51690552761763a8cee7fa2ce89d776bc5152b1f;p=redmine.git Merged r15539 and r15550 (#23067). git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@15557 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb index 77014579b..7734b3984 100644 --- a/lib/redmine/field_format.rb +++ b/lib/redmine/field_format.rb @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +require 'uri' + module Redmine module FieldFormat def self.add(name, klass) @@ -212,7 +214,7 @@ module Redmine end end end - url + URI.encode(url) end protected :url_from_pattern diff --git a/test/unit/lib/redmine/field_format/field_format_test.rb b/test/unit/lib/redmine/field_format/field_format_test.rb index 1f3bc20ea..13177375b 100644 --- a/test/unit/lib/redmine/field_format/field_format_test.rb +++ b/test/unit/lib/redmine/field_format/field_format_test.rb @@ -74,4 +74,12 @@ class Redmine::FieldFormatTest < ActionView::TestCase assert_equal "bar", field.format.formatted_custom_value(self, custom_value, false) assert_equal 'bar', field.format.formatted_custom_value(self, custom_value, true) end + + def test_text_field_with_url_pattern_and_value_containing_a_space_should_format_as_link + field = IssueCustomField.new(:field_format => 'string', :url_pattern => 'http://foo/%value%') + custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "foo bar") + + assert_equal "foo bar", field.format.formatted_custom_value(self, custom_value, false) + assert_equal 'foo bar', field.format.formatted_custom_value(self, custom_value, true) + end end