Skip to content

Commit 710c4ed

Browse files
committed
Update to fix breaking change in ipfs v0.5.0
(pin update switched to multihash rather than multiaddr return)
1 parent 3f12b3a commit 710c4ed

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/multiaddr.jar

420 Bytes
Binary file not shown.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ public List<Multihash> rm(Multihash hash, boolean recursive) throws IOException
206206
return ((List<Object>) json.get("Pins")).stream().map(x -> Cid.decode((String) x)).collect(Collectors.toList());
207207
}
208208

209-
public List<MultiAddress> update(Multihash existing, Multihash modified, boolean unpin) throws IOException {
209+
public List<Multihash> update(Multihash existing, Multihash modified, boolean unpin) throws IOException {
210210
return ((List<Object>)((Map)retrieveAndParse("pin/update?stream-channels=true&arg=" + existing + "&arg=" + modified + "&unpin=" + unpin)).get("Pins"))
211211
.stream()
212-
.map(x -> new MultiAddress((String) x))
212+
.map(x -> Cid.decode((String) x))
213213
.collect(Collectors.toList());
214214
}
215215
}
@@ -767,7 +767,7 @@ private InputStream retrieveStream(String path) throws IOException {
767767
}
768768

769769
private static InputStream getStream(URL target, int timeout) throws IOException {
770-
HttpURLConnection conn = configureConnection(target, "GET", timeout);
770+
HttpURLConnection conn = configureConnection(target, "POST", timeout);
771771
return conn.getInputStream();
772772
}
773773

src/test/java/io/ipfs/api/APITest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public void pinUpdate() throws IOException {
248248

249249
CborObject.CborList root2 = new CborObject.CborList(Arrays.asList(new CborObject.CborMerkleLink(hashChild1), new CborObject.CborLong(42)));
250250
MerkleNode root2Res = ipfs.block.put(Collections.singletonList(root2.toByteArray()), Optional.of("cbor")).get(0);
251-
List<MultiAddress> update = ipfs.pin.update(root1Res.hash, root2Res.hash, true);
251+
List<Multihash> update = ipfs.pin.update(root1Res.hash, root2Res.hash, true);
252252

253253
Map<Multihash, Object> ls = ipfs.pin.ls(IPFS.PinType.all);
254254
boolean childPresent = ls.containsKey(hashChild1);
@@ -282,7 +282,7 @@ public void rawLeafNodePinUpdate() throws IOException {
282282
new CborObject.CborLong(42))
283283
);
284284
MerkleNode root2Res = ipfs.block.put(Collections.singletonList(root2.toByteArray()), Optional.of("cbor")).get(0);
285-
List<MultiAddress> update = ipfs.pin.update(root1Res.hash, root2Res.hash, false);
285+
List<Multihash> update = ipfs.pin.update(root1Res.hash, root2Res.hash, false);
286286
}
287287

288288
@Test

0 commit comments

Comments
 (0)