From 590073b2026a23beb5699377aee536a7e8dead76 Mon Sep 17 00:00:00 2001 From: Dustin Jenkins Date: Wed, 10 Apr 2024 11:05:43 -0700 Subject: [PATCH] Properly check MD5. --- .../canfar/storage/web/resources/FileItemServerResource.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/canfar/storage/web/resources/FileItemServerResource.java b/src/main/java/net/canfar/storage/web/resources/FileItemServerResource.java index 4a912e2..14ca274 100644 --- a/src/main/java/net/canfar/storage/web/resources/FileItemServerResource.java +++ b/src/main/java/net/canfar/storage/web/resources/FileItemServerResource.java @@ -397,7 +397,10 @@ void upload(final UploadOutputStreamWrapper outputStreamWrapper, final DataNode uploadVerifier.verifyByteCount(outputStreamWrapper.getByteCount(), ct.getHttpTransferDetails().getContentLength()); - uploadVerifier.verifyMD5(outputStreamWrapper.getCalculatedMD5(), ct.getHttpTransferDetails().getContentMD5()); + if (ct.getHttpTransferDetails().getDigest() != null) { + uploadVerifier.verifyMD5(outputStreamWrapper.getCalculatedMD5(), + ct.getHttpTransferDetails().getDigest().getSchemeSpecificPart()); + } uploadSuccess(); }