From 4c870c1d3ef37969d0ca0a9494bb0598ef05db63 Mon Sep 17 00:00:00 2001 From: HeoKyungseok <87405823+HeoKyungseok@users.noreply.github.com> Date: Tue, 10 May 2022 20:25:52 +0900 Subject: [PATCH] =?UTF-8?q?=EB=94=94=EB=A0=89=ED=86=A0=EB=A6=AC=20metadata?= =?UTF-8?q?=20=EB=B3=B5=EC=82=AC=20(#5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/ifs_mover/repository/IfsS3.java | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/main/java/ifs_mover/repository/IfsS3.java b/src/main/java/ifs_mover/repository/IfsS3.java index b3d40d3..62fad3c 100644 --- a/src/main/java/ifs_mover/repository/IfsS3.java +++ b/src/main/java/ifs_mover/repository/IfsS3.java @@ -827,28 +827,18 @@ public void setTagging(String bucket, String key, List tagSet) { @Override public String putObject(boolean isFile, String bucket, String key, ObjectData data, long size) { - if (isFile && size > 0) { - PutObjectRequest putObjectRequest = null; - if (data.getFile() != null) { - putObjectRequest = new PutObjectRequest(bucket, key, data.getFile()); - } else { - if (data.getMetadata() == null) { - ObjectMetadata meta = new ObjectMetadata(); - meta.setContentLength(data.getSize()); - data.setMetadata(meta); - } - putObjectRequest = new PutObjectRequest(bucket, key, data.getInputStream(), data.getMetadata()); - } - // putObjectRequest.getRequestClientOptions().setReadLimit(512 * 1024 * 1024); - return client.putObject(putObjectRequest).getETag(); + PutObjectRequest putObjectRequest = null; + if (data.getFile() != null) { + putObjectRequest = new PutObjectRequest(bucket, key, data.getFile()); } else { - ObjectMetadata meta = new ObjectMetadata(); - meta.setContentLength(0L); - InputStream is = new ByteArrayInputStream(new byte[0]); - PutObjectRequest req = new PutObjectRequest(bucket, key, is, meta); - client.putObject(req); - return null; + if (data.getMetadata() == null) { + ObjectMetadata meta = new ObjectMetadata(); + meta.setContentLength(data.getSize()); + data.setMetadata(meta); + } + putObjectRequest = new PutObjectRequest(bucket, key, data.getInputStream(), data.getMetadata()); } + return client.putObject(putObjectRequest).getETag(); } @Override