mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
FIX: add 'Content-Length' header for avatars
This commit is contained in:
@ -24,12 +24,12 @@ class UserAvatarsController < ApplicationController
|
||||
params.require(:version)
|
||||
params.require(:size)
|
||||
|
||||
if params[:version].to_i > LetterAvatar::VERSION
|
||||
return render_dot
|
||||
end
|
||||
return render_dot if params[:version].to_i > LetterAvatar::VERSION
|
||||
|
||||
image = LetterAvatar.generate(params[:username].to_s, params[:size].to_i)
|
||||
|
||||
response.headers["Last-Modified"] = File.ctime(image).httpdate
|
||||
response.headers["Content-Length"] = File.size(image).to_s
|
||||
expires_in 1.year, public: true
|
||||
send_file image, disposition: nil
|
||||
end
|
||||
@ -77,6 +77,7 @@ class UserAvatarsController < ApplicationController
|
||||
|
||||
if image
|
||||
response.headers["Last-Modified"] = File.ctime(image).httpdate
|
||||
response.headers["Content-Length"] = File.size(image).to_s
|
||||
expires_in 1.year, public: true
|
||||
send_file image, disposition: nil
|
||||
else
|
||||
|
Reference in New Issue
Block a user