diff --git a/app/controllers/public/chat_controller.rb b/app/controllers/public/chat_controller.rb index 235b3bd..46a82fc 100644 --- a/app/controllers/public/chat_controller.rb +++ b/app/controllers/public/chat_controller.rb @@ -19,9 +19,13 @@ class ChatController < PublicController def avatar profile = environment.profiles.find_by_identifier(params[:id]) filename, mimetype = profile_icon(profile, :minor, true) - data = File.read(File.join(Rails.root, 'public', filename)) - render :text => data, :layout => false, :content_type => mimetype - expires_in 24.hours + if filename =~ /^https?:/ + redirect_to filename + else + data = File.read(File.join(Rails.root, 'public', filename)) + render :text => data, :layout => false, :content_type => mimetype + expires_in 24.hours + end end def index diff --git a/test/functional/chat_controller_test.rb b/test/functional/chat_controller_test.rb index 8827582..384720d 100644 --- a/test/functional/chat_controller_test.rb +++ b/test/functional/chat_controller_test.rb @@ -26,8 +26,7 @@ class ChatControllerTest < ActionController::TestCase get :avatar, :id => 'testuser' - assert_equal 'image/png', @response.content_type - assert @response.body.index('PNG') + assert_response :redirect end should 'get avatar from community' do -- libgit2 0.21.2