Skip to content

Commit

Permalink
fix: don't compare case of hash
Browse files Browse the repository at this point in the history
  • Loading branch information
jscancella committed Mar 29, 2023
1 parent f17d255 commit e14b203
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/com/github/jscancella/domain/Bag.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ private boolean checkHashes(final Manifest manifest) throws IOException{
for(final ManifestEntry entry : manifest.getEntries()) {
if(Files.exists(entry.getPhysicalLocation())) {
final String hash = hasher.hash(entry.getPhysicalLocation());
if (!hash.equals(entry.getChecksum())){
//https://www.rfc-editor.org/rfc/rfc8493#section-2.1.3
//* The hex-encoded checksum MAY use uppercase and/or lowercase letters.
if (!hash.equalsIgnoreCase(entry.getChecksum())){
throw new CorruptChecksumException("File [{}] is suppose to have a [{}] hash of [{}] but was computed [{}].", entry.getPhysicalLocation(), //entry.getRelativeLocation(),
manifest.getBagitAlgorithmName(), entry.getChecksum(), hash);
}
Expand Down

0 comments on commit e14b203

Please sign in to comment.