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 09f2a56 commit 20e07c7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ private static int getUploadMemThreshold() {
*/
private static String getDigestHeader(String md5sum) {
final String md5Base64 = Base64.getEncoder().encodeToString(HexFormat.of().parseHex(md5sum));
return "MD5=" + md5Base64;
return "md5=:" + md5Base64 + ":";
}

@HEAD
Expand Down Expand Up @@ -298,7 +298,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 @@ -338,7 +338,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 20e07c7

Please sign in to comment.