From f8889cff696b50fa271e668d86dbfc338349f83a Mon Sep 17 00:00:00 2001 From: Yuri Rudman Date: Tue, 3 Sep 2019 14:43:47 -0400 Subject: [PATCH] in some situation empty Hash returned from TokenManager#token_get_info() and User.find_by(:user=>{}) would raise TypeCast error in that case. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1748450 --- app/channels/application_cable/connection.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 2f04326793f..94b9a8b976e 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -11,7 +11,7 @@ def connect def find_verified_user return reject_unauthorized_connection unless cookies[:ws_token] userid = TokenManager.new('ws').token_get_info(cookies[:ws_token], :userid) - if current_user = User.find_by(:userid => userid) + if current_user = User.find_by(:userid => userid.presence) current_user else reject_unauthorized_connection