From d6b896dd221a5be1cfb58e8176d03979eb027a97 Mon Sep 17 00:00:00 2001 From: Wenjie Guo Date: Wed, 20 Nov 2024 15:20:22 +0800 Subject: [PATCH] Clear the metadata cache when setting FORCE_CHECKSUM_AND_WRITE --- .../core/content/DefaultContentDigester.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/commonjava/indy/core/content/DefaultContentDigester.java b/core/src/main/java/org/commonjava/indy/core/content/DefaultContentDigester.java index 95288348e0..70d2d6ce33 100644 --- a/core/src/main/java/org/commonjava/indy/core/content/DefaultContentDigester.java +++ b/core/src/main/java/org/commonjava/indy/core/content/DefaultContentDigester.java @@ -35,6 +35,7 @@ import java.io.InputStream; import java.util.Collections; +import static org.commonjava.indy.core.content.ContentMetadataGenerator.FORCE_CHECKSUM_AND_WRITE; import static org.commonjava.maven.galley.io.ChecksummingTransferDecorator.FORCE_CHECKSUM; /** @@ -127,11 +128,18 @@ public TransferMetadata digest( final StoreKey key, final String path, final Eve return new TransferMetadata( Collections.emptyMap(), 0L ); } - TransferMetadata meta = getContentMetadata( transfer ); - if ( meta != null ) + if ( Boolean.parseBoolean( String.valueOf( eventMetadata.get( FORCE_CHECKSUM_AND_WRITE ) ) ) ) { - logger.debug( "Get transferMetadata: {}", meta ); - return meta; + removeMetadata( transfer ); + } + else + { + TransferMetadata meta = getContentMetadata( transfer ); + if ( meta != null ) + { + logger.debug( "Get transferMetadata: {}", meta ); + return meta; + } } String cacheKey = generateCacheKey( transfer );