From 03f956480455dfaee3d4c1d3dbed2619f1e02b3e Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Wed, 24 Apr 2019 23:03:33 +0200 Subject: [PATCH] FIX: Handle missing letter avatar --- app/controllers/user_avatars_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/user_avatars_controller.rb b/app/controllers/user_avatars_controller.rb index 0fa0d32c701..8a61bfa825b 100644 --- a/app/controllers/user_avatars_controller.rb +++ b/app/controllers/user_avatars_controller.rb @@ -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