From fd353ee551ee887b557f612d12078a1af4a41396 Mon Sep 17 00:00:00 2001 From: Tim Jacomb <21194782+timja@users.noreply.github.com> Date: Wed, 15 Sep 2021 21:13:18 +0100 Subject: [PATCH] Don't fail if file hash is null (#198) --- .../windowsazurestorage/service/UploadService.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/microsoftopentechnologies/windowsazurestorage/service/UploadService.java b/src/main/java/com/microsoftopentechnologies/windowsazurestorage/service/UploadService.java index 559ef988..395b2f5d 100644 --- a/src/main/java/com/microsoftopentechnologies/windowsazurestorage/service/UploadService.java +++ b/src/main/java/com/microsoftopentechnologies/windowsazurestorage/service/UploadService.java @@ -424,8 +424,15 @@ public UploadResult call() { byte[] md5 = block.getValue().getContentMd5(); long endTime = System.currentTimeMillis(); + String fileHash = null; + // seen to occur when uploading large files, (768mb in this case) + // 201 response code with no hash in response + if (md5 != null) { + fileHash = new String(md5, StandardCharsets.UTF_8); + } + return new UploadResult(block.getStatusCode(), null, - new String(md5, StandardCharsets.UTF_8), + fileHash, uploadObject.getName(), uploadObject.getUrl(), length, uploadObject.getStorageType(), startTime, endTime);