FIX: add 'Content-Length' header for avatars

This commit is contained in:
Régis Hanol
2014-10-22 15:39:51 +02:00
parent 6c58cb982a
commit de415b804c
3 changed files with 10 additions and 13 deletions

View File

@ -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