Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: jamessanders/JSync
base: 08beda2365
...
head fork: jamessanders/JSync
compare: 773fad3ffd
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 14 additions and 6 deletions.
  1. +14 −6 java/src/main/java/com/jsync/S3Client.java
View
20 java/src/main/java/com/jsync/S3Client.java
@@ -9,6 +9,7 @@
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
@@ -91,31 +92,38 @@ private int getThreadsOpen() {
int c = point;
+ String basepath = null;
+ try {
+ basepath = URLDecoder.decode(uri.getPath(),this.fileEncoding);
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+
for (S3ObjectSummary object : getObjectList().subList(point, getObjectList().size())) {
String key = "/" + object.getKey();
- String repl = key.replaceFirst("^" + Pattern.quote(uri.getPath()) + "/", "");
- Boolean matches = key.matches("^" + Pattern.quote(uri.getPath()) + "/.*$");
+ String repl = key.replaceFirst("^" + Pattern.quote(basepath) + "/", "");
+ Boolean matches = key.matches("^" + Pattern.quote(basepath) + "/.*$");
- if (key.equals(uri.getPath())) {
+ if (key.equals(basepath)) {
theFile = object;
}
// is subdir
- if (repl.contains("/") && !key.equals(uri.getPath()) && matches) {
+ if (repl.contains("/") && !key.equals(basepath) && matches) {
String name = repl.substring(0, repl.indexOf("/", 1));
if (!visitedSubdirs.contains(name)) {
URIBuilder builder = new URIBuilder();
builder.setScheme("s3");
builder.setHost(bucket);
- builder.setPath(uri.getPath() + "/" + name);
+ builder.setPath(basepath + "/" + name);
subdirs.add(this.getResource(builder.build().toString(), c));
visitedSubdirs.add(name);
}
}
// is file
- else if (!repl.contains("/") && !key.equals(uri.getPath()) && matches) {
+ else if (!repl.contains("/") && !key.equals(basepath) && matches) {
URIBuilder builder = new URIBuilder();
builder.setScheme("s3");
builder.setHost(bucket);

No commit comments for this range

Something went wrong with that request. Please try again.