Issue
DiscourseConnect Provider returns incorrect URL for user_avatar in payload in multisite environment.
When DiscourseConnect is acting as a provider, it returns the avatar_url
in a form that is missing the ‘uploads’ and the name of the multisite host.
For instance
Expected: https://cdn.cdnprovider.com/uploads/dbname/original/1X/1e653a3bc23b6b07017f5635128da0b353489e60.jpg'
Reality: https://cdn.cdnprovider.com/original/1X/1e653a3bc23b6b07017f5635128da0b353489e60.jpg`
The code is here and is reconstructing the URL from the upload
if current_user.uploaded_avatar.present?
base_url =
Discourse.store.external? ? "#{Discourse.store.absolute_base_url}/" : Discourse.base_url
avatar_url =
"#{base_url}#{Discourse.store.get_path_for_upload(current_user.uploaded_avatar)}"
sso.avatar_url = UrlHelper.absolute Discourse.store.cdn_url(avatar_url)
end
while user.uploaded_avatar.url
seems to give the correct result.