Repository: jclouds Updated Branches: refs/heads/master fff12293f -> 984b6ae8f
Handle null ETag in copyBlob and conditional get Mac OS X and Docker aufs do not support xattr and thus have null ETags. Fixes andrewgaul/s3proxy#143. Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/984b6ae8 Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/984b6ae8 Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/984b6ae8 Branch: refs/heads/master Commit: 984b6ae8fbb875c2fe1dc6f382ff80d8c2d98180 Parents: fff1229 Author: Andrew Gaul <[email protected]> Authored: Tue Jun 28 09:54:30 2016 -0700 Committer: Andrew Gaul <[email protected]> Committed: Tue Jun 28 09:55:53 2016 -0700 ---------------------------------------------------------------------- .../blobstore/config/LocalBlobStore.java | 21 ++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds/blob/984b6ae8/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 1b46b34..65d39ba 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/config/LocalBlobStore.java @@ -537,8 +537,9 @@ public final class LocalBlobStore implements BlobStore { throw new KeyNotFoundException(fromContainer, fromName, "while copying"); } - String eTag = maybeQuoteETag(blob.getMetadata().getETag()); + String eTag = blob.getMetadata().getETag(); if (eTag != null) { + eTag = maybeQuoteETag(eTag); if (options.ifMatch() != null && !maybeQuoteETag(options.ifMatch()).equals(eTag)) { throw returnResponseException(412); } @@ -640,13 +641,17 @@ public final class LocalBlobStore implements BlobStore { Blob blob = loadBlob(containerName, key); if (options != null) { - if (options.getIfMatch() != null) { - if (!maybeQuoteETag(blob.getMetadata().getETag()).equals(maybeQuoteETag(options.getIfMatch()))) - throw returnResponseException(412); - } - if (options.getIfNoneMatch() != null) { - if (maybeQuoteETag(blob.getMetadata().getETag()).equals(maybeQuoteETag(options.getIfNoneMatch()))) - throw returnResponseException(304); + String eTag = blob.getMetadata().getETag(); + if (eTag != null) { + eTag = maybeQuoteETag(eTag); + if (options.getIfMatch() != null) { + if (!eTag.equals(maybeQuoteETag(options.getIfMatch()))) + throw returnResponseException(412); + } + if (options.getIfNoneMatch() != null) { + if (eTag.equals(maybeQuoteETag(options.getIfNoneMatch()))) + throw returnResponseException(304); + } } if (options.getIfModifiedSince() != null) { Date modifiedSince = options.getIfModifiedSince();
