FIX: Handle missing letter avatar

This commit is contained in:
Gerhard Schlager 2019-04-24 23:03:33 +02:00
parent 3aa143a52c
commit 03f9564804
1 changed files with 6 additions and 1 deletions

View File

@ -43,8 +43,13 @@ class UserAvatarsController < ApplicationController
params.require(:color)
params.require(:version)
params.require(:size)
hijack do
proxy_avatar("https://avatars.discourse.org/#{params[:version]}/letter/#{params[:letter]}/#{params[:color]}/#{params[:size]}.png", Time.new('1990-01-01'))
begin
proxy_avatar("https://avatars.discourse.org/#{params[:version]}/letter/#{params[:letter]}/#{params[:color]}/#{params[:size]}.png", Time.new('1990-01-01'))
rescue OpenURI::HTTPError
render_blank
end
end
end