From a697396e8c87e30e7deb1aa9f7865e5b34a4c25f Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Tue, 9 Feb 2016 10:43:12 -0800 Subject: [PATCH] Correctly remove prefix in DelimiterFilter Previously this called String.replaceFirst which uses a regular expression and incorrectly handles characters like *. Also remove other correct but unnecessary call to String.replaceFirst. --- .../java/org/jclouds/blobstore/config/LocalBlobStore.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 ce244efb95..a5f340606b 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java @@ -39,7 +39,6 @@ import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.UUID; -import java.util.regex.Pattern; import javax.annotation.Resource; import javax.inject.Inject; @@ -473,7 +472,7 @@ public final class LocalBlobStore implements BlobStore { return name.indexOf(delimiter) == -1; } if (name.startsWith(prefix)) { - String unprefixedName = name.replaceFirst(prefix, ""); + String unprefixedName = name.substring(prefix.length()); if (unprefixedName.equals("")) { // a blob that matches the prefix should also be returned return true; @@ -498,7 +497,7 @@ public final class LocalBlobStore implements BlobStore { String working = metadata.getName(); if (prefix != null) { if (working.startsWith(prefix)) { - working = working.replaceFirst(Pattern.quote(prefix), ""); + working = working.substring(prefix.length()); } else { return NO_PREFIX; }