Allow setting content metadata during copyBlob

Also remove unneeded call to setBlobMetadata which copy sets.
This commit is contained in:
Andrew Gaul 2015-12-13 22:28:01 -08:00
parent 85bc4a6b7e
commit b64d05abb9
1 changed files with 12 additions and 6 deletions

View File

@ -242,15 +242,25 @@ public class AzureBlobStore extends BaseBlobStore {
URI source = context.getSigner().signGetBlob(fromContainer, fromName).getEndpoint();
String eTag = sync.copyBlob(source, toContainer, toName, azureOptions.build());
ContentMetadataBuilder builder = ContentMetadataBuilder.create();
Optional<ContentMetadata> contentMetadata = options.getContentMetadata();
if (contentMetadata.isPresent()) {
ContentMetadataBuilder builder = ContentMetadataBuilder.create();
String contentDisposition = contentMetadata.get().getContentDisposition();
if (contentDisposition != null) {
builder.contentDisposition(contentDisposition);
}
String contentEncoding = contentMetadata.get().getContentEncoding();
if (contentEncoding != null) {
builder.contentEncoding(contentEncoding);
}
String contentLanguage = contentMetadata.get().getContentLanguage();
if (contentLanguage != null) {
builder.contentLanguage(contentLanguage);
}
String contentType = contentMetadata.get().getContentType();
if (contentType != null) {
builder.contentType(contentType);
@ -259,10 +269,6 @@ public class AzureBlobStore extends BaseBlobStore {
eTag = sync.setBlobProperties(toContainer, toName, builder.build());
}
if (userMetadata.isPresent()) {
eTag = sync.setBlobMetadata(toContainer, toName, userMetadata.get());
}
return eTag;
}