Skip to content

Commit 69e4383

Browse files
committed
Fix dag put command
1 parent 0c29bb4 commit 69e4383

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -544,20 +544,20 @@ public byte[] get(Cid cid) throws IOException {
544544
}
545545

546546
public MerkleNode put(byte[] object) throws IOException {
547-
return put("json", object, "cbor");
547+
return put("dag-json", object, "dag-cbor");
548548
}
549549

550550
public MerkleNode put(String inputFormat, byte[] object) throws IOException {
551-
return put(inputFormat, object, "cbor");
551+
return put(inputFormat, object, "dag-cbor");
552552
}
553553

554554
public MerkleNode put(byte[] object, String outputFormat) throws IOException {
555-
return put("json", object, outputFormat);
555+
return put("dag-json", object, outputFormat);
556556
}
557557

558558
public MerkleNode put(String inputFormat, byte[] object, String outputFormat) throws IOException {
559559
String prefix = protocol + "://" + host + ":" + port + version;
560-
Multipart m = new Multipart(prefix + "dag/put/?stream-channels=true&input-enc=" + inputFormat + "&f=" + outputFormat, "UTF-8");
560+
Multipart m = new Multipart(prefix + "dag/put/?stream-channels=true&input-codec=" + inputFormat + "&store-codec=" + outputFormat, "UTF-8");
561561
m.addFilePart("file", Paths.get(""), new NamedStreamable.ByteArrayWrapper(object));
562562
String res = m.finish();
563563
return MerkleNode.fromJSON(JSONParser.parse(res));

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void dagCbor() throws IOException {
4242
tmp.put("data", new CborObject.CborString(value));
4343
CborObject original = CborObject.CborMap.build(tmp);
4444
byte[] object = original.toByteArray();
45-
MerkleNode put = ipfs.dag.put("cbor", object);
45+
MerkleNode put = ipfs.dag.put("dag-cbor", object);
4646

4747
Cid cid = (Cid) put.hash;
4848

0 commit comments

Comments
 (0)