Skip to content

Commit

Permalink
Merge pull request #70 from kookmin-sw/feat/resume-debug2
Browse files Browse the repository at this point in the history
fix: resume images null 일 때 반복문 돌지 않고 빈 리스트 반환
  • Loading branch information
KimChanJin97 authored May 13, 2024
2 parents f3ef70a + 4d316ce commit ee5bb36
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions src/main/java/capstone/facefriend/bucket/BucketService.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,27 +131,24 @@ public List<String> uploadResumeImages(

List<String> resumeImageS3urls = new ArrayList<>();

for (MultipartFile image : images) {

if (image.isEmpty() || image.getSize() == 0) {
return List.of();
if (images != null) {
for (MultipartFile image : images) {
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(image.getInputStream().available());
metadata.setContentType(image.getContentType());

String imageObjectName = UUID.randomUUID() + resumePostfix;

amazonS3.putObject(
new PutObjectRequest(
bucketName,
imageObjectName,
image.getInputStream(),
metadata
).withCannedAcl(CannedAccessControlList.PublicRead)
);
resumeImageS3urls.add(amazonS3.getUrl(bucketName, imageObjectName).toString());
}

ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(image.getInputStream().available());
metadata.setContentType(image.getContentType());

String imageObjectName = UUID.randomUUID() + resumePostfix;

amazonS3.putObject(
new PutObjectRequest(
bucketName,
imageObjectName,
image.getInputStream(),
metadata
).withCannedAcl(CannedAccessControlList.PublicRead)
);
resumeImageS3urls.add(amazonS3.getUrl(bucketName, imageObjectName).toString());
}
return resumeImageS3urls;
}
Expand Down

0 comments on commit ee5bb36

Please sign in to comment.