Repository: jclouds Updated Branches: refs/heads/master a472a878b -> 19d54369d
Propagate delimiter changes to LocalBlobStore. Propagates the changes to add delimiter support to the local blob store. The prefix option no longer works with the non-recursive option. The caller _must_ set the delimiter option to enable the same functionality. Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/19d54369 Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/19d54369 Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/19d54369 Branch: refs/heads/master Commit: 19d54369db3ac20ad0314339fd6255b1c4f39e5f Parents: e4161a5 Author: Timur Alperovich <[email protected]> Authored: Mon Jul 13 17:19:13 2015 -0700 Committer: Andrew Gaul <[email protected]> Committed: Tue Jul 14 14:11:34 2015 -0700 ---------------------------------------------------------------------- .../org/jclouds/blobstore/config/LocalBlobStore.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds/blob/19d54369/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java ---------------------------------------------------------------------- diff --git a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java index cf9a04c..4ea316c 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java @@ -344,8 +344,8 @@ public final class LocalBlobStore implements BlobStore { } })); - if (!options.isRecursive()) { - return extractCommonPrefixes(contents, storageStrategy.getSeparator(), options.getPrefix()); + if (options.getDelimiter() != null) { + return extractCommonPrefixes(contents, options.getDelimiter(), options.getPrefix()); } return contents; @@ -472,14 +472,7 @@ public final class LocalBlobStore implements BlobStore { if (prefix == null || prefix.isEmpty()) { return name.indexOf(delimiter) == -1; } - String prefixMatch; - if (prefix.endsWith(delimiter)) { - prefixMatch = "^" + Pattern.quote(prefix) + ".*"; - } else { - // We should correctly match strings like "foobar/" where the prefix is only "foo" - prefixMatch = "^" + Pattern.quote(prefix) + ".*" + Pattern.quote(delimiter) + ".*"; - } - if (name.matches(prefixMatch)) { + if (name.startsWith(prefix)) { String unprefixedName = name.replaceFirst(prefix, ""); if (unprefixedName.equals("")) { // we are the prefix in this case, return false
