Mastodon API: URI encode hashtag name in generated URLs

Otherwise hashtags with word characters other than those allowed in URLs (e.g. Japanese characters) produce hashtag URLs that are invalid.
This commit is contained in:
shadowfacts 2019-09-07 19:50:45 +00:00
parent c45013df8e
commit e5c6bf3673
1 changed files with 1 additions and 1 deletions

View File

@ -499,7 +499,7 @@ def build_tags(object_tags) when is_list(object_tags) do
object_tags = for tag when is_binary(tag) <- object_tags, do: tag
Enum.reduce(object_tags, [], fn tag, tags ->
tags ++ [%{name: tag, url: "/tag/#{tag}"}]
tags ++ [%{name: tag, url: "/tag/#{URI.encode(tag)}"}]
end)
end