]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/3868'
authorTom Hughes <tom@compton.nu>
Tue, 3 Jan 2023 19:20:31 +0000 (19:20 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 3 Jan 2023 19:20:31 +0000 (19:20 +0000)
app/helpers/browse_tags_helper.rb
test/helpers/browse_tags_helper_test.rb

index 0784d03caefabca670e501f9ee0160373fcc0869..c6aeb8c5470fa9a984af272b3a7ca7f989a030eb 100644 (file)
@@ -32,7 +32,7 @@ module BrowseTagsHelper
     elsif colour_value = colour_preview(key, value)
       tag.span("", :class => "colour-preview-box", :"data-colour" => colour_value, :title => t("browse.tag_details.colour_preview", :colour_value => colour_value)) + colour_value
     else
-      linkify h(value)
+      safe_join(h(value).split(";").map { |x| linkify(x) }, ";")
     end
   end
 
index 3f36b921092618a45e1ea2625c33d025d4dba46c..2329a7c961d8f23b28cc9d0ccf2fe80211ade425 100644 (file)
@@ -49,6 +49,12 @@ class BrowseTagsHelperTest < ActionView::TestCase
 
     html = format_value("contact", "foo@example.com")
     assert_dom_equal "<a title=\"Email foo@example.com\" href=\"mailto:foo@example.com\">foo@example.com</a>", html
+
+    html = format_value("source", "https://example.com")
+    assert_dom_equal "<a href=\"https://example.com\" rel=\"nofollow\">https://example.com</a>", html
+
+    html = format_value("source", "https://example.com;hello;https://example.net")
+    assert_dom_equal "<a href=\"https://example.com\" rel=\"nofollow\">https://example.com</a>;hello;<a href=\"https://example.net\" rel=\"nofollow\">https://example.net</a>", html
   end
 
   def test_wiki_link