From 2ecc613c5d16c406486427468040399caedffdd2 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Thu, 18 Jul 2019 23:17:29 +0200 Subject: [PATCH] FIX: URL encode usernames in user profile links in RSS feeds user_url() failed for usernames containing Unicode characters because it expects URL encoded usernames. RSS feeds do not support IRIs, so lets convert them to URIs by encoding the usernames. --- app/views/list/list.rss.erb | 2 +- app/views/topics/show.rss.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/list/list.rss.erb b/app/views/list/list.rss.erb index 8824eeb86b0..0895d208dab 100644 --- a/app/views/list/list.rss.erb +++ b/app/views/list/list.rss.erb @@ -20,7 +20,7 @@ <%= topic.category.name %> -

<%= t('author_wrote', author: link_to("@#{username}", "#{Discourse.base_url}/u/#{topic.user.username_lower}")).html_safe %>

+

<%= t('author_wrote', author: link_to("@#{username}", "#{Discourse.base_url}/u/#{url_encode(topic.user.username_lower)}")).html_safe %>

<% end %>
<%- if first_post = topic.ordered_posts.first %> diff --git a/app/views/topics/show.rss.erb b/app/views/topics/show.rss.erb index 729fa86071d..2a71f1f1635 100644 --- a/app/views/topics/show.rss.erb +++ b/app/views/topics/show.rss.erb @@ -18,7 +18,7 @@ ]]> -

<%= t('author_wrote', author: link_to("@#{post.user.username}", user_url(post.user.username_lower))).html_safe %>

+

<%= t('author_wrote', author: link_to("@#{post.user.username}", "#{Discourse.base_url}/u/#{url_encode(post.user.username_lower)}")).html_safe %>

<% if post.hidden %> <%= t('flagging.user_must_edit').html_safe %>