FIX: use default favicon if a bad favicon is specified

This commit is contained in:
Sam Saffron 2015-12-22 18:08:27 +11:00
parent c87fff670d
commit 00342faff9

View file

@ -106,7 +106,9 @@ class StaticController < ApplicationController
end
if data.bytesize == 0
render text: UserAvatarsController::DOT, content_type: "image/gif"
@@default_favicon ||= File.read(Rails.root + "public/images/default-favicon.png")
response.headers["Content-Length"] = @@default_favicon.bytesize.to_s
render text: @@default_favicon, content_type: "image/png"
else
expires_in 1.year, public: true
response.headers["Expires"] = 1.year.from_now.httpdate