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:
Ka-Hing Cheung 2015-05-28 15:39:36 -07:00 committed by Andrew Gaul
parent 4f6af13329
commit 573ceb51c3
3 changed files with 5 additions and 1 deletions

View File

@ -230,6 +230,7 @@ public class TransientStorageStrategy implements LocalStorageStrategy {
MutableContentMetadata oldMd = in.getPayload().getContentMetadata();
HttpUtils.copy(oldMd, payload.getContentMetadata());
payload.getContentMetadata().setContentMD5(contentMd5);
payload.getContentMetadata().setContentLength((long) input.length);
Blob blob = blobFactory.create(BlobStoreUtils.copy(in.getMetadata()));
blob.setPayload(payload);
blob.getMetadata().setContainer(containerName);

View File

@ -658,7 +658,9 @@ public final class LocalBlobStore implements BlobStore {
byte[] byteArray = out.toByteArray();
blob.setPayload(byteArray);
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);

View File

@ -284,6 +284,7 @@ public class BaseBlobStoreIntegrationTest extends BaseViewLiveTest<BlobStoreCont
protected <T extends BlobMetadata> T validateMetadata(T md, String container, String name) {
assertEquals(md.getName(), name);
assertEquals(md.getContainer(), container);
assertEquals(md.getSize(), md.getContentMetadata().getContentLength());
return md;
}