Skip to content

Commit

Permalink
Fix mirroring raw blocks via bulk stat api
Browse files Browse the repository at this point in the history
  • Loading branch information
ianopolous committed Apr 12, 2024
1 parent e5ea311 commit 4a43315
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/org/peergos/net/APIHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ public void handleCallToAPI(HttpExchange httpExchange) {
List<HashedBlock> blocks = ipfs.getBlocks(wants, peers, true);
if (wants.size() == blocks.size()) {
List<List<String>> links = blocks.stream()
.map(b -> CborObject.getLinks(b.hash, b.block).stream().map(Cid::toString).collect(Collectors.toList()))
.map(b -> b.hash.codec.equals(Cid.Codec.Raw) ?
Collections.<String>emptyList() :
CborObject.getLinks(b.hash, b.block).stream().map(Cid::toString).collect(Collectors.toList()))
.collect(Collectors.toList());
replyJson(httpExchange, JSONParser.toString(links));
} else {
Expand Down

0 comments on commit 4a43315

Please sign in to comment.