mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-27 17:04:52 +09:00
If an outbox item is missing an @id, display whole activity in error message
This commit is contained in:
parent
a96fcb8835
commit
7429345cc0
1 changed files with 7 additions and 2 deletions
|
@ -65,7 +65,7 @@ import Yesod.Persist.Core
|
||||||
import qualified Data.ByteString.Char8 as BC (unpack)
|
import qualified Data.ByteString.Char8 as BC (unpack)
|
||||||
import qualified Data.HashMap.Strict as M
|
import qualified Data.HashMap.Strict as M
|
||||||
import qualified Data.Text as T
|
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 Data.Vector as V
|
||||||
import qualified Database.Esqueleto as E
|
import qualified Database.Esqueleto as E
|
||||||
|
|
||||||
|
@ -88,6 +88,8 @@ import Data.Time.Clock.Local
|
||||||
import Database.Persist.Local
|
import Database.Persist.Local
|
||||||
import Yesod.Persist.Local
|
import Yesod.Persist.Local
|
||||||
|
|
||||||
|
import qualified Data.Aeson.Encode.Pretty.ToEncoding as P
|
||||||
|
|
||||||
import Vervis.ActivityPub
|
import Vervis.ActivityPub
|
||||||
import Vervis.ActorKey
|
import Vervis.ActorKey
|
||||||
import Vervis.API
|
import Vervis.API
|
||||||
|
@ -117,7 +119,10 @@ objectSummary o =
|
||||||
objectId o =
|
objectId o =
|
||||||
case M.lookup "id" o <|> M.lookup "@id" o of
|
case M.lookup "id" o <|> M.lookup "@id" o of
|
||||||
Just (String t) | not (T.null t) -> t
|
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
|
getInbox here actor hash = do
|
||||||
key <- decodeKeyHashid404 hash
|
key <- decodeKeyHashid404 hash
|
||||||
|
|
Loading…
Reference in a new issue