From a02e89e36b8b6cdaabe35f4d7b12b2d61532c7fa Mon Sep 17 00:00:00 2001 From: RickyRister Date: Tue, 19 Aug 2025 22:21:29 -0700 Subject: [PATCH] check hash before checking if user already has access --- servatrice/src/serversocketinterface.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/servatrice/src/serversocketinterface.cpp b/servatrice/src/serversocketinterface.cpp index 7d768410b..f0d4771a7 100644 --- a/servatrice/src/serversocketinterface.cpp +++ b/servatrice/src/serversocketinterface.cpp @@ -834,6 +834,11 @@ Response::ResponseCode AbstractServerSocketInterface::cmdReplaySubmitCode(const const auto &replayName = replayExistsQuery->value(0).toString(); + // Check if hash is correct + if (hash != createHashForReplay(gameId.toInt())) { + return Response::RespNameNotFound; + } + // Determine if user already has access to replay auto *alreadyAccessQuery = sqlInterface->prepareQuery( "select 1 from {prefix}_replays_access where id_game = :id_game and id_player = :id_player"); @@ -846,11 +851,6 @@ Response::ResponseCode AbstractServerSocketInterface::cmdReplaySubmitCode(const return Response::RespOk; } - // Check if hash is correct - if (hash != createHashForReplay(gameId.toInt())) { - return Response::RespNameNotFound; - } - // Grant the User access to the replay auto *grantReplayAccessQuery = sqlInterface->prepareQuery("insert into {prefix}_replays_access (id_game, id_player, replay_name, do_not_hide) "