From e35f97cf37f0baac6249592ec35bd5f5f75d977b Mon Sep 17 00:00:00 2001 From: Guilherme Garnier Date: Tue, 29 Dec 2020 16:54:34 -0300 Subject: [PATCH] Fix "possible unprotected redirect" warning (#10511) * Fix "possible unprotected redirect" warning * Fix 'line too long' warning --- app/controllers/chat_channel_memberships_controller.rb | 2 +- app/controllers/comments_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/chat_channel_memberships_controller.rb b/app/controllers/chat_channel_memberships_controller.rb index 3daf89e1b..b55e393b8 100644 --- a/app/controllers/chat_channel_memberships_controller.rb +++ b/app/controllers/chat_channel_memberships_controller.rb @@ -174,7 +174,7 @@ class ChatChannelMembershipsController < ApplicationController invite_cache_key = "chat-channel-invite-#{@chat_channel.id}" invitation_slug = Rails.cache.read(invite_cache_key) existing_membership = ChatChannelMembership.find_by(user_id: current_user.id, chat_channel_id: @chat_channel.id) - redirect_to "/connect/#{@chat_channel.slug}" if existing_membership && existing_membership.status == "active" + redirect_to URI.parse("/connect/#{@chat_channel.slug}").path if existing_membership&.status == "active" @link_expired = true if invitation_slug != params[:invitation_slug] end diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 9504ef2ee..e17213151 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -263,7 +263,7 @@ class CommentsController < ApplicationController redirect_url = @comment.commentable&.path if redirect_url flash[:success] = "Comment was successfully deleted." - redirect_to redirect_url + redirect_to URI.parse(redirect_url).path else redirect_to_comment_path end