Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixes file path encoding issues

  • Loading branch information...
commit 08beda23657b7e9ee66a0768462920d641317e92 1 parent 8bce922
@jamessanders authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 java/src/main/java/com/jsync/S3Client.java
View
11 java/src/main/java/com/jsync/S3Client.java
@@ -12,6 +12,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
+import java.net.URLEncoder;
/**
* User: sanders
@@ -26,6 +27,7 @@
private String bucket;
private boolean useReducedRedundancy;
private boolean makePublic;
+ private String fileEncoding;
public S3Client(URI base, AmazonS3Client client, boolean useReducedRedundancy, boolean makePublic) {
@@ -35,6 +37,7 @@ public S3Client(URI base, AmazonS3Client client, boolean useReducedRedundancy, b
this.threadsOpen = 0;
this.useReducedRedundancy = useReducedRedundancy;
this.makePublic = makePublic;
+ this.fileEncoding = System.getProperty("file.encoding");
}
public S3Client(URI base, AWSCredentials creds, boolean useReducedRedundancy, boolean makePublic) {
@@ -73,8 +76,12 @@ private int getThreadsOpen() {
public List<S3Resource> getChildren(String path, int point) throws URISyntaxException {
String bucket = base.getHost();
- URI uri;
- uri = new URI(path);
+ URI uri = null;
+ try {
+ uri = new URI(URLEncoder.encode(path, this.fileEncoding));
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
S3ObjectSummary theFile = null;
Please sign in to comment.
Something went wrong with that request. Please try again.