Fix replacing metadata in BaseBlobStore

Fixes Atmos errors.  Uncovered by removing unneeded addContentMetadata
call in BaseBlobIntegrationTest.testCopyBlobReplaceMetadata.
This commit is contained in:
Andrew Gaul 2016-01-15 04:13:04 -08:00
parent b63f74a6eb
commit 688890819e
2 changed files with 14 additions and 8 deletions

View File

@ -262,18 +262,25 @@ public abstract class BaseBlobStore implements BlobStore {
InputStream is = null;
try {
is = blob.getPayload().openStream();
ContentMetadata metadata = blob.getMetadata().getContentMetadata();
BlobBuilder.PayloadBlobBuilder builder = blobBuilder(toName)
.payload(is)
.cacheControl(metadata.getCacheControl())
.payload(is);
Long contentLength = blob.getMetadata().getContentMetadata().getContentLength();
if (contentLength != null) {
builder.contentLength(contentLength);
}
ContentMetadata metadata;
if (options.getContentMetadata().isPresent()) {
metadata = options.getContentMetadata().get();
} else {
metadata = blob.getMetadata().getContentMetadata();
}
builder.cacheControl(metadata.getCacheControl())
.contentDisposition(metadata.getContentDisposition())
.contentEncoding(metadata.getContentEncoding())
.contentLanguage(metadata.getContentLanguage())
.contentType(metadata.getContentType());
Long contentLength = metadata.getContentLength();
if (contentLength != null) {
builder.contentLength(contentLength);
}
Optional<Map<String, String>> userMetadata = options.getUserMetadata();
if (userMetadata.isPresent()) {
builder.userMetadata(userMetadata.get());

View File

@ -906,7 +906,6 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest {
.contentEncoding("compress")
.contentLanguage("fr")
.contentType("audio/ogg");
addContentMetadata(blobBuilder);
Blob blob = blobBuilder.build();
String fromContainer = getContainerName();