Skip to content

Commit

Permalink
api: allow compute CID for arbitrary data
Browse files Browse the repository at this point in the history
Signed-off-by: p4u <[email protected]>
  • Loading branch information
p4u committed May 8, 2024
1 parent 1f4d7e5 commit faf1350
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions api/elections.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,6 @@ func (*API) computeCidHandler(msg *apirest.APIdata, ctx *httprouter.HTTPContext)
if err := json.Unmarshal(msg.Data, req); err != nil {
return err
}
// check if the file is a valid JSON object
var js json.RawMessage
if err := json.Unmarshal(req.Payload, &js); err != nil {
return ErrCantParsePayloadAsJSON
}
data, err := json.Marshal(&File{
CID: "ipfs://" + ipfs.CalculateCIDv1json(req.Payload),
})
Expand Down

0 comments on commit faf1350

Please sign in to comment.