FIX: Users with unicode usernames unable to load more topics in activity (#16627)

This was due to a server side bug when unicode usernames have been
enabled. We were double encoding the unicode username in the URL
resulting in a invalid URL.
This commit is contained in:
Alan Guo Xiang Tan
2022-05-05 09:48:22 +08:00
committed by GitHub
parent aa343d506f
commit 8271828948
2 changed files with 30 additions and 1 deletions

View File

@ -424,12 +424,21 @@ class ListController < ApplicationController
end
opts = opts.dup
if SiteSetting.unicode_usernames && opts[:group_name]
opts[:group_name] = UrlHelper.encode_component(opts[:group_name])
end
opts.delete(:category) if page_params.include?(:category_slug_path_with_id)
public_send(method, opts.merge(page_params)).sub('.json?', '?')
url = public_send(method, opts.merge(page_params)).sub('.json?', '?')
# Unicode usernames need to be encoded when calling Rails' path helper. However, it means that the already
# encoded username are encoded again which we do not want. As such, we unencode the url once when unicode usernames
# have been enabled.
url = UrlHelper.unencode(url) if SiteSetting.unicode_usernames
url
end
def ensure_can_see_profile!(target_user = nil)