7
7
8
8
public class IPFS {
9
9
10
- public static final String MIN_VERSION = "0.4.2 " ;
10
+ public static final String MIN_VERSION = "0.4.4 " ;
11
11
public enum PinType {all , direct , indirect , recursive }
12
12
public List <String > ObjectTemplates = Arrays .asList ("unixfs-dir" );
13
13
public List <String > ObjectPatchTypes = Arrays .asList ("add-link" , "rm-link" , "set-data" , "append-data" );
@@ -49,9 +49,11 @@ public IPFS(String host, int port, String version) {
49
49
// Check IPFS is sufficiently recent
50
50
try {
51
51
String ipfsVersion = version ();
52
- int [] parts = Stream .of (ipfsVersion .split ("\\ ." )).mapToInt (Integer ::parseInt ).toArray ();
53
- int [] minParts = Stream .of (MIN_VERSION .split ("\\ ." )).mapToInt (Integer ::parseInt ).toArray ();
54
- if (parts [0 ] < minParts [0 ] || parts [1 ] < minParts [1 ] || parts [2 ] < minParts [2 ])
52
+ String [] parts = ipfsVersion .split ("\\ ." );
53
+ String [] minParts = MIN_VERSION .split ("\\ ." );
54
+ if (parts [0 ].compareTo (minParts [0 ]) < 0
55
+ || parts [1 ].compareTo (minParts [1 ]) < 0
56
+ || parts [2 ].compareTo (minParts [2 ]) < 0 )
55
57
throw new IllegalStateException ("You need to use a more recent version of IPFS! >= " + MIN_VERSION );
56
58
} catch (IOException e ) {
57
59
throw new RuntimeException (e );
@@ -68,7 +70,6 @@ public List<MerkleNode> add(List<NamedStreamable> files) throws IOException {
68
70
m .addFilePart ("file" , f );
69
71
String res = m .finish ();
70
72
return JSONParser .parseStream (res ).stream ()
71
- .skip (1 )
72
73
.map (x -> MerkleNode .fromJSON ((Map <String , Object >) x ))
73
74
.collect (Collectors .toList ());
74
75
}
0 commit comments