From 9cbd153682663f120daec7408c7e244f64819054 Mon Sep 17 00:00:00 2001 From: hyobinkim Date: Tue, 10 Jan 2023 14:08:24 +0900 Subject: [PATCH] =?UTF-8?q?Feat=20:=20#33=20=EC=A3=BC=EC=84=9D=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=ED=9B=84=20=ED=95=A8=EC=88=98=EC=9D=98=20=EC=9D=98?= =?UTF-8?q?=EB=8F=84=EB=A5=BC=20=EB=8D=94=20=EC=9E=98=20=EB=82=98=ED=83=80?= =?UTF-8?q?=EB=82=B4=EB=8F=84=EB=A1=9D=20=ED=95=A8=EC=88=98=EB=AA=85=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/godchigam/godchigam/infra/S3Storage/AwsS3Service.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/godchigam/src/main/java/com/godchigam/godchigam/infra/S3Storage/AwsS3Service.java b/godchigam/src/main/java/com/godchigam/godchigam/infra/S3Storage/AwsS3Service.java index 0f58790..0b1424e 100644 --- a/godchigam/src/main/java/com/godchigam/godchigam/infra/S3Storage/AwsS3Service.java +++ b/godchigam/src/main/java/com/godchigam/godchigam/infra/S3Storage/AwsS3Service.java @@ -34,7 +34,7 @@ public String uploadFile(MultipartFile multipartFile, String filePath) { String fileNameBefore = "https://gadchigam.s3.ap-northeast-2.amazonaws.com/"; log.info(multipartFile.getOriginalFilename()); - String fileName = filePath + "/" + createFileName(multipartFile.getOriginalFilename()); + String fileName = filePath + "/" + createRandomizedFileName(multipartFile.getOriginalFilename()); ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setContentLength(multipartFile.getSize()); objectMetadata.setContentType(multipartFile.getContentType()); @@ -52,7 +52,7 @@ public String uploadFile(MultipartFile multipartFile, String filePath) { } - private String createFileName(String fileName) { // 먼저 파일 업로드 시, 파일명을 난수화하기 위해 random으로 돌립니다. + private String createRandomizedFileName(String fileName) { return UUID.randomUUID().toString().concat(getFileExtension(fileName)); }