Skip to content

use correct version of method to URL encode string #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/main/java/io/ipfs/api/IPFS.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public List<MerkleNode> add(List<NamedStreamable> files, boolean wrap, boolean h
m.addSubtree(Paths.get(""), file);
} else
m.addFilePart("file", Paths.get(""), file);
};
}
String res = m.finish();
return JSONParser.parseStream(res).stream()
.map(x -> MerkleNode.fromJSON((Map<String, Object>) x))
Expand All @@ -145,7 +145,7 @@ public List<MerkleNode> add(List<NamedStreamable> files, AddArgs args) throws IO
m.addSubtree(Paths.get(""), file);
} else
m.addFilePart("file", Paths.get(""), file);
};
}
String res = m.finish();
return JSONParser.parseStream(res).stream()
.map(x -> MerkleNode.fromJSON((Map<String, Object>) x))
Expand Down Expand Up @@ -420,10 +420,8 @@ public Object peers(String topic) throws IOException {

/**
*
* @param topic
* @param topic topic to publish to
* @param data url encoded data to be published
* @return
* @throws IOException
*/
public void pub(String topic, String data) {
String encodedTopic = Multibase.encode(Multibase.Base.Base64Url, topic.getBytes());
Expand Down Expand Up @@ -471,7 +469,7 @@ public List<Map> codecs(boolean numeric, boolean supported) throws IOException
}

public Map format(Cid hash, Optional<String> f, Optional<String> v, Optional<String> mc, Optional<String> b) throws IOException {
String fArg = f.isPresent() ? "&f=" + URLEncoder.encode(f.get()) : "";
String fArg = f.isPresent() ? "&f=" + URLEncoder.encode(f.get(), "UTF-8") : "";
String vArg = v.isPresent() ? "&v=" + v.get() : "";
String mcArg = mc.isPresent() ? "&mc=" + mc.get() : "";
String bArg = b.isPresent() ? "&b=" + b.get() : "";
Expand Down