Fix "possible unprotected redirect" warning (#10511)

* Fix "possible unprotected redirect" warning

* Fix 'line too long' warning
This commit is contained in:
Guilherme Garnier 2020-12-29 16:54:34 -03:00 committed by GitHub
parent 183a672113
commit e35f97cf37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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