From cdd3950167e79dadb3b610c99130023849e45bb3 Mon Sep 17 00:00:00 2001 From: Lucy Cifferello <12953208+elvece@users.noreply.github.com> Date: Thu, 11 Jul 2024 16:39:09 -0400 Subject: [PATCH] change insert to do nothing on conflict --- src/Handler/Util.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Handler/Util.hs b/src/Handler/Util.hs index f293223..e6f632d 100644 --- a/src/Handler/Util.hs +++ b/src/Handler/Util.hs @@ -99,7 +99,7 @@ import Network.HTTP.Types.Status (status401) import Yesod (getsYesod) import Settings (AppSettings(whitelist)) import Network.HTTP.Types (status200) -import Database.Persist (insert_) +import Database.Persist (insert_, insertBy) import Yesod (lookupPostParam) import Data.Maybe (isNothing) @@ -307,7 +307,7 @@ checkAdminAuthUpload pkgId = do else if authorized && newPkg -- if pkg is whitelisted and a new upload, add as authorized for this admin user then do - runDB $ insert_ (AdminPkgs (AdminKey name) pkgId) + _ <- runDB $ insertBy (AdminPkgs (AdminKey name) pkgId) pure name else sendResponseText status401 "User not authorized to upload this package." else sendResponseText status401 "Package does not belong on this registry."