Skip to content

Commit

Permalink
Ignore case comparing checksums. Fix #10879.
Browse files Browse the repository at this point in the history
Signed-off-by: David Kocher <dkocher@iterate.ch>
  • Loading branch information
dkocher committed Nov 19, 2019
1 parent 94711de commit 77aacf3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions core/src/main/java/ch/cyberduck/core/io/Checksum.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;

import java.util.Objects;

public final class Checksum {
private static final Logger log = Logger.getLogger(Checksum.class);

Expand Down Expand Up @@ -74,7 +72,7 @@ public boolean equals(final Object o) {
if(algorithm != checksum.algorithm) {
return false;
}
if(!Objects.equals(hash, checksum.hash)) {
if(!StringUtils.equalsIgnoreCase(hash, checksum.hash)) {
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public StorageObject upload(final Path file, final Local local, final BandwidthT
else {
reference = complete.getEtag();
}
if(!expected.equals(reference)) {
if(!StringUtils.equalsIgnoreCase(expected, reference)) {
if(S3Session.isAwsHostname(session.getHost().getHostname())) {
throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()),
MessageFormat.format("Mismatch between MD5 hash {0} of uploaded data and ETag {1} returned by the server",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public void close() throws IOException {
else {
reference = complete.getEtag();
}
if(!expected.equals(reference)) {
if(!StringUtils.equalsIgnoreCase(expected, reference)) {
if(S3Session.isAwsHostname(session.getHost().getHostname())) {
throw new ChecksumException(MessageFormat.format(LocaleFactory.localizedString("Upload {0} failed", "Error"), file.getName()),
MessageFormat.format("Mismatch between MD5 hash {0} of uploaded data and ETag {1} returned by the server",
Expand Down

0 comments on commit 77aacf3

Please sign in to comment.