mirror of https://github.com/apache/jclouds.git
metadata and content metadata should have the same length
for range get in a LocalBlobStore, metadata.getSize() has the original blob size and contentMetadata.getContentLength() has the actual payload size. Other blobstores have the same size in both
This commit is contained in:
parent
4f6af13329
commit
573ceb51c3
|
@ -230,6 +230,7 @@ public class TransientStorageStrategy implements LocalStorageStrategy {
|
||||||
MutableContentMetadata oldMd = in.getPayload().getContentMetadata();
|
MutableContentMetadata oldMd = in.getPayload().getContentMetadata();
|
||||||
HttpUtils.copy(oldMd, payload.getContentMetadata());
|
HttpUtils.copy(oldMd, payload.getContentMetadata());
|
||||||
payload.getContentMetadata().setContentMD5(contentMd5);
|
payload.getContentMetadata().setContentMD5(contentMd5);
|
||||||
|
payload.getContentMetadata().setContentLength((long) input.length);
|
||||||
Blob blob = blobFactory.create(BlobStoreUtils.copy(in.getMetadata()));
|
Blob blob = blobFactory.create(BlobStoreUtils.copy(in.getMetadata()));
|
||||||
blob.setPayload(payload);
|
blob.setPayload(payload);
|
||||||
blob.getMetadata().setContainer(containerName);
|
blob.getMetadata().setContainer(containerName);
|
||||||
|
|
|
@ -658,7 +658,9 @@ public final class LocalBlobStore implements BlobStore {
|
||||||
byte[] byteArray = out.toByteArray();
|
byte[] byteArray = out.toByteArray();
|
||||||
blob.setPayload(byteArray);
|
blob.setPayload(byteArray);
|
||||||
HttpUtils.copy(cmd, blob.getPayload().getContentMetadata());
|
HttpUtils.copy(cmd, blob.getPayload().getContentMetadata());
|
||||||
blob.getPayload().getContentMetadata().setContentLength(Long.valueOf(byteArray.length));
|
Long size = Long.valueOf(byteArray.length);
|
||||||
|
blob.getPayload().getContentMetadata().setContentLength(size);
|
||||||
|
blob.getMetadata().setSize(size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkNotNull(blob.getPayload(), "payload " + blob);
|
checkNotNull(blob.getPayload(), "payload " + blob);
|
||||||
|
|
|
@ -284,6 +284,7 @@ public class BaseBlobStoreIntegrationTest extends BaseViewLiveTest<BlobStoreCont
|
||||||
protected <T extends BlobMetadata> T validateMetadata(T md, String container, String name) {
|
protected <T extends BlobMetadata> T validateMetadata(T md, String container, String name) {
|
||||||
assertEquals(md.getName(), name);
|
assertEquals(md.getName(), name);
|
||||||
assertEquals(md.getContainer(), container);
|
assertEquals(md.getContainer(), container);
|
||||||
|
assertEquals(md.getSize(), md.getContentMetadata().getContentLength());
|
||||||
return md;
|
return md;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue