Keep trailing semicolons in formatted tag values

This commit is contained in:
Anton Khorev 2023-12-14 18:08:06 +03:00
parent 9d717d4541
commit 07436bc1b0
2 changed files with 7 additions and 1 deletions

View file

@ -36,7 +36,7 @@ module BrowseTagsHelper
elsif colour_value = colour_preview(key, value)
tag.span("", :class => "colour-preview-box float-end m-1 border border-dark border-opacity-10", :"data-colour" => colour_value, :title => t("browse.tag_details.colour_preview", :colour_value => colour_value)) + colour_value
else
safe_join(value.split(";").map { |x| linkify(h(x)) }, ";")
safe_join(value.split(";", -1).map { |x| linkify(h(x)) }, ";")
end
end

View file

@ -22,6 +22,12 @@ class BrowseTagsHelperTest < ActionView::TestCase
html = format_value("unknown", "unknown")
assert_dom_equal "unknown", html
html = format_value("unknown", "abc;def")
assert_dom_equal "abc;def", html
html = format_value("unknown", "foo;")
assert_dom_equal "foo;", html
html = format_value("addr:street", "Rue de l'Amigo")
assert_dom_equal "Rue de l&#39;Amigo", html