mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 19:00:32 -06:00
FIX: redirect old avatars to proper user_avatar route
This commit is contained in:
parent
60b46f837b
commit
5b3a758ba9
@ -52,14 +52,13 @@ class UserAvatarsController < ApplicationController
|
||||
|
||||
image = nil
|
||||
version = params[:version].to_i
|
||||
|
||||
return render_dot unless version > 0 && user_avatar = user.user_avatar
|
||||
|
||||
upload = Upload.find_by(id: version) if user_avatar.contains_upload?(version)
|
||||
upload ||= user.uploaded_avatar if user.uploaded_avatar_id == version
|
||||
|
||||
if user.uploaded_avatar && !upload
|
||||
return redirect_to "/avatar/#{hostname}/#{user.username_lower}/#{size}/#{user.uploaded_avatar_id}.png"
|
||||
return redirect_to "/user_avatar/#{hostname}/#{user.username_lower}/#{size}/#{user.uploaded_avatar_id}.png"
|
||||
elsif upload
|
||||
original = Discourse.store.path_for(upload)
|
||||
if Discourse.store.external? || File.exists?(original)
|
||||
|
Loading…
Reference in New Issue
Block a user