From 7429345cc0816aec363bd6aa17fc4cd43c82086f Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Mon, 26 Sep 2022 13:52:01 +0000 Subject: [PATCH] If an outbox item is missing an @id, display whole activity in error message --- src/Vervis/Web/Actor.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Vervis/Web/Actor.hs b/src/Vervis/Web/Actor.hs index 1bfe0a9..e2306a1 100644 --- a/src/Vervis/Web/Actor.hs +++ b/src/Vervis/Web/Actor.hs @@ -65,7 +65,7 @@ import Yesod.Persist.Core import qualified Data.ByteString.Char8 as BC (unpack) import qualified Data.HashMap.Strict as M import qualified Data.Text as T -import qualified Data.Text.Lazy as TL (toStrict) +import qualified Data.Text.Lazy as TL import qualified Data.Vector as V import qualified Database.Esqueleto as E @@ -88,6 +88,8 @@ import Data.Time.Clock.Local import Database.Persist.Local import Yesod.Persist.Local +import qualified Data.Aeson.Encode.Pretty.ToEncoding as P + import Vervis.ActivityPub import Vervis.ActorKey import Vervis.API @@ -117,7 +119,10 @@ objectSummary o = objectId o = case M.lookup "id" o <|> M.lookup "@id" o of Just (String t) | not (T.null t) -> t - _ -> error "'id' field not found" + _ -> + error $ + "'id' field not found" ++ + TL.unpack (P.encodePrettyToLazyText o) getInbox here actor hash = do key <- decodeKeyHashid404 hash