Skip to content

Commit f537af7

Browse files
committed
Value for Content-MD5 is already decoded.
1 parent 0e2f30c commit f537af7

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

azure/src/main/java/ch/cyberduck/core/azure/AzureAttributesFinderFeature.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public PathAttributes toAttributes(final BlobProperties properties) {
109109
attributes.setSize(properties.getBlobSize());
110110
attributes.setModificationDate(properties.getLastModified().toInstant().toEpochMilli());
111111
if(properties.getContentMd5() != null) {
112-
attributes.setChecksum(Checksum.parse(Hex.encodeHexString(Base64.decodeBase64(properties.getContentMd5()))));
112+
attributes.setChecksum(Checksum.parse(Hex.encodeHexString(properties.getContentMd5())));
113113
}
114114
attributes.setETag(properties.getETag());
115115
final Map<String, String> custom = new HashMap<>();
@@ -124,7 +124,7 @@ public PathAttributes toAttributes(final BlobItemProperties properties) {
124124
attributes.setModificationDate(properties.getLastModified().toInstant().toEpochMilli());
125125
attributes.setETag(properties.getETag());
126126
if(properties.getContentMd5() != null) {
127-
attributes.setChecksum(Checksum.parse(Hex.encodeHexString(Base64.decodeBase64(properties.getContentMd5()))));
127+
attributes.setChecksum(Checksum.parse(Hex.encodeHexString(properties.getContentMd5())));
128128
}
129129
return attributes;
130130
}

azure/src/test/java/ch/cyberduck/core/azure/AzureAttributesFinderFeatureTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import ch.cyberduck.core.PathAttributes;
1010
import ch.cyberduck.core.exception.NotfoundException;
1111
import ch.cyberduck.core.features.Delete;
12+
import ch.cyberduck.core.io.MD5ChecksumCompute;
1213
import ch.cyberduck.core.transfer.TransferStatus;
1314
import ch.cyberduck.test.IntegrationTest;
1415

@@ -42,10 +43,12 @@ public void testNotFound() throws Exception {
4243
public void testFind() throws Exception {
4344
final Path container = new Path("cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
4445
final Path test = new Path(container, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
45-
new AzureTouchFeature(session).touch(new AzureWriteFeature(session), test, new TransferStatus());
46+
new AzureTouchFeature(session).touch(new AzureWriteFeature(session), test, new TransferStatus()
47+
.setChecksum(new MD5ChecksumCompute().compute("")));
4648
final AzureAttributesFinderFeature f = new AzureAttributesFinderFeature(session);
4749
final PathAttributes attributes = f.find(test);
4850
assertEquals(0L, attributes.getSize());
51+
assertEquals("d41d8cd98f00b204e9800998ecf8427e", attributes.getChecksum().hash);
4952
assertNotNull(attributes.getETag());
5053
new AzureDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
5154
}

0 commit comments

Comments
 (0)