Skip to content

Commit 7557151

Browse files
committed
Pass full data into lookup() so that it can check 1 or 2 (Base256Emoji) bytes
1 parent 778fdb0 commit 7557151

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/main/java/io/ipfs/multibase/Multibase.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public enum Base {
4444
lookup.put(b.prefix, b);
4545
}
4646

47-
public static Base lookup(String p) {
47+
public static Base lookup(String data) {
48+
String p = data.substring(0, 1);
4849
if (!lookup.containsKey(p))
4950
throw new IllegalArgumentException("Unknown Multibase type: " + p);
5051
return lookup.get(p);
@@ -93,7 +94,7 @@ public static String encode(Base b, byte[] data) {
9394
}
9495

9596
public static Base encoding(String data) {
96-
return Base.lookup(data.substring(0, 1));
97+
return Base.lookup(data);
9798
}
9899

99100
public static byte[] decode(String data) {

0 commit comments

Comments
 (0)