From 54dae66d8e26f7439d31a760cd08469c6cafd7bc Mon Sep 17 00:00:00 2001 From: yma Date: Tue, 25 Jun 2024 18:10:23 +0800 Subject: [PATCH] Fix the HEAD request to avoid reading file for checksum digest --- .../core/bind/jaxrs/ContentAccessHandler.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bindings/jaxrs/src/main/java/org/commonjava/indy/core/bind/jaxrs/ContentAccessHandler.java b/bindings/jaxrs/src/main/java/org/commonjava/indy/core/bind/jaxrs/ContentAccessHandler.java index c2bf37376d..02404d4484 100644 --- a/bindings/jaxrs/src/main/java/org/commonjava/indy/core/bind/jaxrs/ContentAccessHandler.java +++ b/bindings/jaxrs/src/main/java/org/commonjava/indy/core/bind/jaxrs/ContentAccessHandler.java @@ -380,13 +380,14 @@ public Response doHead( final String packageType, final String type, final Strin responseHelper.setInfoHeaders( builder, item, sk, path, true, contentType, httpMetadata ); - - if(!path.endsWith("/")) { - // Content hashing headers - builder.header(ApplicationHeader.md5.key(), contentDigester.digest(sk, path, new EventMetadata()).getDigests().get(ContentDigest.MD5)); - builder.header(ApplicationHeader.sha1.key(), contentDigester.digest(sk, path, new EventMetadata()).getDigests().get(ContentDigest.SHA_1)); - } - + + // Remove this to avoid reading file for checksum digest during HEAD request +// if(!path.endsWith("/")) { +// // Content hashing headers +// builder.header(ApplicationHeader.md5.key(), contentDigester.digest(sk, path, new EventMetadata()).getDigests().get(ContentDigest.MD5)); +// builder.header(ApplicationHeader.sha1.key(), contentDigester.digest(sk, path, new EventMetadata()).getDigests().get(ContentDigest.SHA_1)); +// } + if ( builderModifier != null ) { builderModifier.accept( builder );