From ec12ae0fe502aaae858ee60c256376c604b07093 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Sun, 3 Mar 2024 13:09:30 +0900 Subject: [PATCH] Plug leak in handleCompleteMultipartUpload In jclouds 2.6.0 BlobStore.getBlob returns an InputStream instead of a ByteSource for the filesystem. Previously the call site leaked the former since it only consumed the BlobMetadata. Instead call BlobStore.blobMedata which does not include the payload. Fixes JCLOUDS-1626. --- src/main/java/org/gaul/s3proxy/S3ProxyHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java b/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java index d6447fa..a88e4d5 100644 --- a/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java +++ b/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java @@ -2253,7 +2253,7 @@ public class S3ProxyHandler { PutOptions options; if (Quirks.MULTIPART_REQUIRES_STUB.contains(getBlobStoreType( blobStore))) { - metadata = blobStore.getBlob(containerName, uploadId).getMetadata(); + metadata = blobStore.blobMetadata(containerName, uploadId); BlobAccess access = blobStore.getBlobAccess(containerName, uploadId); options = new PutOptions().setBlobAccess(access); @@ -2632,6 +2632,7 @@ public class S3ProxyHandler { blobName, uploadId, createFakeBlobMetadata(blobStore), new PutOptions()); + // TODO: Blob can leak on precondition failures. Blob blob = blobStore.getBlob(sourceContainerName, sourceBlobName, options); if (blob == null) {