1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-27 02:04:52 +09:00

If an outbox item is missing an @id, display whole activity in error message

This commit is contained in:
fr33domlover 2022-09-26 13:52:01 +00:00
parent a96fcb8835
commit 7429345cc0

View file

@ -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