Skip to content

Commit 6f00fa4

Browse files
committed
Make API call compatible with API docs, https://ipfs.io/docs/api/#api-v0-get and fix potential bugs when trying access the jsipfs daemon.
1 parent 8d2a2fb commit 6f00fa4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/io/ipfs/api/IPFS.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,24 @@ public List<MerkleNode> add(List<NamedStreamable> files, boolean wrap, boolean h
9393
}
9494

9595
public List<MerkleNode> ls(Multihash hash) throws IOException {
96-
Map res = retrieveMap("ls/" + hash);
96+
Map res = retrieveMap("ls?arg=" + hash);
9797
return ((List<Object>) res.get("Objects")).stream().map(x -> MerkleNode.fromJSON((Map) x)).collect(Collectors.toList());
9898
}
9999

100100
public byte[] cat(Multihash hash) throws IOException {
101-
return retrieve("cat/" + hash);
101+
return retrieve("cat?arg=" + hash);
102102
}
103103

104104
public byte[] cat(Multihash hash, String subPath) throws IOException {
105105
return retrieve("cat?arg=" + hash + URLEncoder.encode(subPath, "UTF-8"));
106106
}
107107

108108
public byte[] get(Multihash hash) throws IOException {
109-
return retrieve("get/" + hash);
109+
return retrieve("get?arg=" + hash);
110110
}
111111

112112
public InputStream catStream(Multihash hash) throws IOException {
113-
return retrieveStream("cat/" + hash);
113+
return retrieveStream("cat?arg=" + hash);
114114
}
115115

116116
public List<Multihash> refs(Multihash hash, boolean recursive) throws IOException {

0 commit comments

Comments
 (0)