Skip to content

Commit ca0ffb8

Browse files
Merge pull request #816 from TikhomirovSergey/mykola-mokhnach-push_file
push file. The addition to the #812
2 parents a84490c + be484e1 commit ca0ffb8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/main/java/io/appium/java_client/MobileCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.openqa.selenium.remote.CommandInfo;
2323
import org.openqa.selenium.remote.http.HttpMethod;
2424

25+
import java.nio.charset.StandardCharsets;
2526
import java.time.Duration;
2627
import java.util.AbstractMap;
2728
import java.util.HashMap;
@@ -376,7 +377,7 @@ public static ImmutableMap<String, Object> prepareArguments(String[] params,
376377
*/
377378
public static Map.Entry<String, Map<String, ?>> pushFileCommand(String remotePath, byte[] base64Data) {
378379
String[] parameters = new String[] {"path", "data"};
379-
Object[] values = new Object[] {remotePath, base64Data};
380+
Object[] values = new Object[]{remotePath, new String(base64Data, StandardCharsets.UTF_8)};
380381
return new AbstractMap.SimpleEntry<>(PUSH_FILE, prepareArguments(parameters, values));
381382
}
382383
}

src/test/java/io/appium/java_client/android/AndroidDriverTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class AndroidDriverTest extends BaseAndroidTest {
6262
.getBytes());
6363
driver.pushFile("/data/local/tmp/remote.txt", data);
6464
byte[] returnData = driver.pullFile("/data/local/tmp/remote.txt");
65-
String returnDataDecoded = new String(Base64.decodeBase64(returnData));
65+
String returnDataDecoded = new String(returnData);
6666
assertEquals(
6767
"The eventual code is no more than the deposit of your understanding. ~E. W. Dijkstra",
6868
returnDataDecoded);
@@ -75,7 +75,7 @@ public class AndroidDriverTest extends BaseAndroidTest {
7575
+ "more than the deposit of your understanding. ~E. W. Dijkstra", "UTF-8", true);
7676
driver.pushFile("/data/local/tmp/remote2.txt", temp);
7777
byte[] returnData = driver.pullFile("/data/local/tmp/remote2.txt");
78-
String returnDataDecoded = new String(Base64.decodeBase64(returnData));
78+
String returnDataDecoded = new String(returnData);
7979
assertEquals(
8080
"The eventual code is no more than the deposit of "
8181
+ "your understanding. ~E. W. Dijkstra",

0 commit comments

Comments
 (0)