From 32adee0a757e04a89512aa60ac737f7d2a6386a1 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Mon, 17 Aug 2020 09:01:14 +0000 Subject: [PATCH] Don't accept Darcs MRs with more than one patch bundle file --- src/Vervis/API.hs | 8 ++++++++ src/Vervis/Federation/Ticket.hs | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/Vervis/API.hs b/src/Vervis/API.hs index 3496375..1304a98 100644 --- a/src/Vervis/API.hs +++ b/src/Vervis/API.hs @@ -689,6 +689,10 @@ createTicketC (Entity pidUser personUser) sharerUser summary audience ticket muT case ebundle of Left _ -> throwE "MR bundle specified as a URI" Right (hBundle, bundle) -> checkBundle hBundle bundle + case (typ, diffs) of + (PatchMediaTypeDarcs, _ :| _ : _) -> + throwE "More than one Darcs patch bundle provided" + _ -> return () return (branch, typ, diffs) where checkBranch @@ -1477,6 +1481,10 @@ offerTicketC (Entity pidUser personUser) sharerUser summary audience ticket uTar case ebundle of Left _ -> throwE "MR bundle specified as a URI" Right (hBundle, bundle) -> checkBundle hBundle bundle + case (typ, diffs) of + (PatchMediaTypeDarcs, _ :| _ : _) -> + throwE "More than one Darcs patch bundle provided" + _ -> return () return (branch, typ, diffs) where checkBranch h lu = do diff --git a/src/Vervis/Federation/Ticket.hs b/src/Vervis/Federation/Ticket.hs index 48f7ad4..03bd11d 100644 --- a/src/Vervis/Federation/Ticket.hs +++ b/src/Vervis/Federation/Ticket.hs @@ -154,6 +154,10 @@ checkOfferTicket author ticket uTarget = do case ebundle of Left _ -> throwE "MR bundle specified as a URI" Right (hBundle, bundle) -> checkBundle hBundle bundle + case (typ, diffs) of + (PatchMediaTypeDarcs, _ :| _ : _) -> + throwE "More than one Darcs patch bundle provided" + _ -> return () return (branch, typ, diffs) where checkBranch h lu = do @@ -611,6 +615,10 @@ checkCreateTicket author ticket muTarget = do case ebundle of Left _ -> throwE "MR bundle specified as a URI" Right (hBundle, bundle) -> checkBundle hBundle bundle + case (typ, patches) of + (PatchMediaTypeDarcs, _ :| _ : _) -> + throwE "More than one Darcs patch bundle provided" + _ -> return () return (branch, typ, patches) where checkBranch