Skip to content

Commit 1c7ebf1

Browse files
immortal71Copilot
andauthored
Update copi.owasp.org/lib/copi_web/controllers/api_controller.ex
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9478aae commit 1c7ebf1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

copi.owasp.org/lib/copi_web/controllers/api_controller.ex

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@ defmodule CopiWeb.ApiController do
2525
{:ok, dealt_card} ->
2626
with {:ok, updated_game} <- Game.find(game.id) do
2727
CopiWeb.Endpoint.broadcast(topic(game.id), "game:updated", updated_game)
28+
conn |> json(%{"id" => dealt_card.id})
2829
else
2930
{:error, _reason} ->
30-
conn |> put_status(:internal_server_error) |> json(%{"error" => "Could not find updated game"})
31+
# V16.5.3: Fail securely if the updated game cannot be loaded/broadcast
32+
conn
33+
|> put_status(:internal_server_error)
34+
|> json(%{"error" => "Could not find updated game"})
3135
end
32-
conn |> json(%{"id" => dealt_card.id})
3336
{:error, _changeset} ->
3437
conn |> put_status(:internal_server_error) |> json(%{"error" => "Could not update dealt card"})
3538
end

0 commit comments

Comments
 (0)