Skip to content

Commit

Permalink
MCR-3303 use Repr-Digest header instead of Digest header
Browse files Browse the repository at this point in the history
  • Loading branch information
toKrause committed Nov 20, 2024
1 parent eb12bc8 commit 2e1b638
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private static int getUploadMemThreshold() {
*/
private static String getDigestHeader(String md5sum) {
final String md5Base64 = Base64.getEncoder().encodeToString(getMD5Digest(md5sum));
return "MD5=" + md5Base64;
return "md5=:" + md5Base64 + ":";
}

private static byte[] getMD5Digest(String md5sum) {
Expand Down Expand Up @@ -313,7 +313,7 @@ public Response getFileOrDirectoryMetadata() {
.lastModified(Date.from(fileAttributes.lastModifiedTime().toInstant()))
.header(HttpHeaders.CONTENT_LENGTH, fileAttributes.size())
.tag(getETag(fileAttributes))
.header("Digest", getDigestHeader(fileAttributes.digest().toHexString()))
.header("Repr-Digest", getDigestHeader(fileAttributes.digest().toHexString()))
.build();
}

Expand Down Expand Up @@ -353,7 +353,7 @@ public Response getFileOrDirectory(@Context UriInfo uriInfo, @Context HttpHeader
content.setMimeType(context.getMimeType(mcrPath.getFileName().toString()));
try {
final List<Map.Entry<String, String>> responseHeader = List
.of(Map.entry("Digest", getDigestHeader(fileAttributes.digest().toHexString())));
.of(Map.entry("Repr-Digest", getDigestHeader(fileAttributes.digest().toHexString())));
return MCRRestContentHelper.serveContent(content, uriInfo, requestHeader, responseHeader);
} catch (IOException e) {
throw MCRErrorResponse.fromStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode())
Expand Down

0 comments on commit 2e1b638

Please sign in to comment.