diff --git a/plugins/nexus-repository-pypi/src/main/java/org/sonatype/nexus/repository/pypi/internal/PyPiHostedFacetImpl.java b/plugins/nexus-repository-pypi/src/main/java/org/sonatype/nexus/repository/pypi/internal/PyPiHostedFacetImpl.java index 6b49d6387..e79c967ef 100644 --- a/plugins/nexus-repository-pypi/src/main/java/org/sonatype/nexus/repository/pypi/internal/PyPiHostedFacetImpl.java +++ b/plugins/nexus-repository-pypi/src/main/java/org/sonatype/nexus/repository/pypi/internal/PyPiHostedFacetImpl.java @@ -178,11 +178,11 @@ public class PyPiHostedFacetImpl savedIndex.formatAttributes().set(P_ASSET_KIND, AssetKind.INDEX.name()); StorageFacet storageFacet = getRepository().facet(StorageFacet.class); - TempBlob tempBlob = storageFacet.createTempBlob(new ByteArrayInputStream(html.getBytes(UTF_8)), HASH_ALGORITHMS); - saveAsset(tx, savedIndex, tempBlob, TEXT_HTML, new AttributesMap()); - - return savedIndex; + try (TempBlob tempBlob = storageFacet.createTempBlob(new ByteArrayInputStream(html.getBytes(UTF_8)), PyPiDataUtils.HASH_ALGORITHMS)) { + saveAsset(tx, savedIndex, tempBlob, TEXT_HTML, new AttributesMap()); + return savedIndex; + } } private String buildIndex(final String name, final StorageTx tx) {