Skip to content

A platform for community discussion. Free, open, simple.

FIX: URL encode usernames in user profile links in RSS feeds

Gerhard Schlager2ecc613c5d16
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 @@
<category><%= topic.category.name %></category>
<description><![CDATA[
<% if username.present? %>
- <p><%= t('author_wrote', author: link_to("@#{username}", "#{Discourse.base_url}/u/#{topic.user.username_lower}")).html_safe %></p>
+ <p><%= t('author_wrote', author: link_to("@#{username}", "#{Discourse.base_url}/u/#{url_encode(topic.user.username_lower)}")).html_safe %></p>
<% end %>
<blockquote>
<%- 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 @@
<dc:creator><![CDATA[<%= "@#{post.user.username}#{" #{post.user.name}" if (post.user.name.present? && SiteSetting.enable_names?)}" -%>]]></dc:creator>
<description><![CDATA[
<% post_url = Discourse.base_url + post.url %>
- <p><%= t('author_wrote', author: link_to("@#{post.user.username}", user_url(post.user.username_lower))).html_safe %></p>
+ <p><%= t('author_wrote', author: link_to("@#{post.user.username}", "#{Discourse.base_url}/u/#{url_encode(post.user.username_lower)}")).html_safe %></p>
<blockquote>
<% if post.hidden %>
<%= t('flagging.user_must_edit').html_safe %>