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

View file

@ -499,7 +499,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView 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