Skip to content

Commit

Permalink
MCR-3225 apply suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yagee-de committed Nov 20, 2024
1 parent ef5394e commit 2286a65
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,6 @@ public String toHexString() {
return MCRUtils.toHexString(this.value);
}

/**
* Returns the value of the digest.
*
* @return Digest value.
*/
public byte[] getValue() {
return Arrays.copyOf(value, value.length);
}

@Override
public boolean equals(Object o) {
if (!(o instanceof MCRDigest mcrDigest)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.Base64;
import java.util.Comparator;
import java.util.Date;
import java.util.HexFormat;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand All @@ -53,7 +54,6 @@
import org.mycore.common.config.MCRConfiguration2;
import org.mycore.common.content.MCRPathContent;
import org.mycore.common.content.util.MCRRestContentHelper;
import org.mycore.common.digest.MCRMD5Digest;
import org.mycore.datamodel.metadata.MCRObjectID;
import org.mycore.datamodel.niofs.MCRDigestAttributeView;
import org.mycore.datamodel.niofs.MCRFileAttributes;
Expand Down Expand Up @@ -253,15 +253,10 @@ private static int getUploadMemThreshold() {
* @see <a href="https://tools.ietf.org/html/rfc5843">RFC 45843</a>
*/
private static String getDigestHeader(String md5sum) {
final String md5Base64 = Base64.getEncoder().encodeToString(getMD5Digest(md5sum));
final String md5Base64 = Base64.getEncoder().encodeToString(HexFormat.of().parseHex(md5sum));
return "MD5=" + md5Base64;
}

private static byte[] getMD5Digest(String md5sum) {
MCRMD5Digest md5 = new MCRMD5Digest(md5sum);
return md5.getValue();
}

@HEAD
@MCRCacheControl(sMaxAge = @MCRCacheControl.Age(time = 1, unit = TimeUnit.DAYS))
@Operation(description = "get information about mime-type(s), last modified, ETag (md5sum) and ranges support",
Expand Down

0 comments on commit 2286a65

Please sign in to comment.