##// END OF EJS Templates
Custom field List Link values to URL breaks on entries with spaces (#23067)....
Jean-Philippe Lang -
r15157:bbd24fe350a3
parent child
Show More
@@ -7,6 +7,9
7 7 <%= call_hook(:view_welcome_index_left) %>
8 8 </div>
9 9
10 <%= link_to "Test", "http://foo/test bar" %>
11 <%= link_to "Test", "http://foo/test%20bar" %>
12
10 13 <div class="splitcontentright">
11 14 <% if @news.any? %>
12 15 <div class="news box">
@@ -15,6 +15,8
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 require 'uri'
19
18 20 module Redmine
19 21 module FieldFormat
20 22 def self.add(name, klass)
@@ -212,7 +214,7 module Redmine
212 214 end
213 215 end
214 216 end
215 url
217 URI.encode(url)
216 218 end
217 219 protected :url_from_pattern
218 220
@@ -74,4 +74,12 class Redmine::FieldFormatTest < ActionView::TestCase
74 74 assert_equal "bar", field.format.formatted_custom_value(self, custom_value, false)
75 75 assert_equal '<a href="http://foo/bar">bar</a>', field.format.formatted_custom_value(self, custom_value, true)
76 76 end
77
78 def test_text_field_with_url_pattern_and_value_containing_a_space_should_format_as_link
79 field = IssueCustomField.new(:field_format => 'string', :url_pattern => 'http://foo/%value%')
80 custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "foo bar")
81
82 assert_equal "foo bar", field.format.formatted_custom_value(self, custom_value, false)
83 assert_equal '<a href="http://foo/foo%20bar">foo bar</a>', field.format.formatted_custom_value(self, custom_value, true)
84 end
77 85 end
General Comments 0
You need to be logged in to leave comments. Login now