JCLOUDS-1005: Do not map "none" SHA1 to null

Callers expect that ETag has a non-null value.
This commit is contained in:
Andrew Gaul 2016-06-17 07:43:06 -07:00
parent 3d84d3cb2d
commit f66e0a3fcc
2 changed files with 1 additions and 5 deletions

View File

@ -42,10 +42,6 @@ public abstract class B2Object {
@SerializedNames({"fileId", "fileName", "accountId", "bucketId", "contentLength", "contentSha1", "contentType", "fileInfo", "action", "uploadTimestamp", "payload"})
public static B2Object create(String fileId, String fileName, @Nullable String accountId, @Nullable String bucketId, @Nullable Long contentLength, @Nullable String contentSha1, @Nullable String contentType, @Nullable Map<String, String> fileInfo, @Nullable Action action, @Nullable Long uploadTimestamp, @Nullable Payload payload) {
if ("none".equals(contentSha1)) {
// large files may have "none" sha1
contentSha1 = null;
}
if (fileInfo != null) {
fileInfo = ImmutableMap.copyOf(fileInfo);
}

View File

@ -118,7 +118,7 @@ public final class MultipartApiMockTest {
assertThat(response.action()).isEqualTo(Action.UPLOAD);
assertThat(response.bucketId()).isEqualTo(BUCKET_ID);
assertThat(response.contentLength()).isEqualTo(208158542);
assertThat(response.contentSha1()).isNull();
assertThat(response.contentSha1()).isEqualTo("none");
assertThat(response.contentType()).isEqualTo(CONTENT_TYPE);
assertThat(response.fileId()).isEqualTo(FILE_ID);
assertThat(response.fileInfo()).isEqualTo(FILE_INFO);