mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
FIX: redirect old avatars to proper user_avatar route
This commit is contained in:
parent
60b46f837b
commit
5b3a758ba9
1 changed files with 1 additions and 2 deletions
|
@ -52,14 +52,13 @@ class UserAvatarsController < ApplicationController
|
||||||
|
|
||||||
image = nil
|
image = nil
|
||||||
version = params[:version].to_i
|
version = params[:version].to_i
|
||||||
|
|
||||||
return render_dot unless version > 0 && user_avatar = user.user_avatar
|
return render_dot unless version > 0 && user_avatar = user.user_avatar
|
||||||
|
|
||||||
upload = Upload.find_by(id: version) if user_avatar.contains_upload?(version)
|
upload = Upload.find_by(id: version) if user_avatar.contains_upload?(version)
|
||||||
upload ||= user.uploaded_avatar if user.uploaded_avatar_id == version
|
upload ||= user.uploaded_avatar if user.uploaded_avatar_id == version
|
||||||
|
|
||||||
if user.uploaded_avatar && !upload
|
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
|
elsif upload
|
||||||
original = Discourse.store.path_for(upload)
|
original = Discourse.store.path_for(upload)
|
||||||
if Discourse.store.external? || File.exists?(original)
|
if Discourse.store.external? || File.exists?(original)
|
||||||
|
|
Loading…
Reference in a new issue