File tree Expand file tree Collapse file tree 3 files changed +20
-5
lines changed
Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -52,11 +52,7 @@ public List<NamedStreamable> getChildren() {
5252 }
5353
5454 public Optional <String > getName () {
55- try {
56- return Optional .of (URLEncoder .encode (source .getName (), "UTF-8" ));
57- } catch (UnsupportedEncodingException e ) {
58- throw new RuntimeException (e );
59- }
55+ return Optional .of (source .getName ());
6056 }
6157 }
6258
Original file line number Diff line number Diff line change @@ -56,6 +56,15 @@ public void testAddArgs() throws Exception {
5656 Assert .assertEquals (1 , tree .size ());
5757 Assert .assertEquals ("index.html" , tree .get (0 ).name .get ());
5858 }
59+ @ Test
60+ public void testFilenameEncoding () throws Exception {
61+ Path path = Paths .get ("src/test/resources/folder/你好.html" );
62+ NamedStreamable file = new FileWrapper (path .toFile ());
63+ List <MerkleNode > tree = ipfs .add (file );
64+
65+ Assert .assertEquals (1 , tree .size ());
66+ Assert .assertEquals ("你好.html" , tree .get (0 ).name .get ());
67+ }
5968
6069 @ Test
6170 public void testSingleWrapped () throws Exception {
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < title > Blank page</ title >
5+ < meta charset ="utf-8 " />
6+ </ head >
7+ < body >
8+ < h1 > blank</ h1 >
9+ </ body >
10+ </ html >
You can’t perform that action at this time.
0 commit comments