mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
FIX: crop avatars on the server instead of the client
FIX: support for dots in S3 bucket names
This commit is contained in:
parent
bdde331e7a
commit
85d4d3223c
9 changed files with 51 additions and 169 deletions
|
@ -49,19 +49,14 @@ class UserAvatarsController < ApplicationController
|
|||
protected
|
||||
|
||||
def show_in_site(hostname)
|
||||
size = params[:size].to_i
|
||||
|
||||
|
||||
username = params[:username].to_s
|
||||
return render_dot unless user = User.find_by(username_lower: username.downcase)
|
||||
|
||||
version = params[:version].to_i
|
||||
return render_dot unless version > 0 && user_avatar = user.user_avatar
|
||||
|
||||
# some sanity checks
|
||||
if size < 8 || size > 500
|
||||
return render_dot
|
||||
end
|
||||
size = params[:size].to_i
|
||||
return render_dot if size < 8 || size > 500
|
||||
|
||||
if !Discourse.avatar_sizes.include?(size) && Discourse.store.external?
|
||||
closest = Discourse.avatar_sizes.to_a.min{|a,b| (size-a).abs <=> (size-b).abs}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue