Skip to content

Commit

Permalink
fix: S3 업로더 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
zillionme committed Oct 9, 2023
1 parent 7445936 commit 5aba57c
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ public class AwsS3Service {
@Value("${cloud.aws.s3.bucket}")
private String bucketName;

@Value("${cloud.aws.s3.directory")
private String directory;

@Value("${cloud.aws.region.static}")
private String clientRegion;

Expand All @@ -48,10 +45,11 @@ public String uploadFile(final MultipartFile multipartFile) {
final String fileName = buildFileName(multipartFile.getOriginalFilename());

final ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setContentLength(multipartFile.getSize());
objectMetadata.setContentType(multipartFile.getContentType());

try (final InputStream inputStream = multipartFile.getInputStream()) {
amazonS3.putObject(new PutObjectRequest(bucketName, directory + fileName, inputStream, objectMetadata)
amazonS3.putObject(new PutObjectRequest(bucketName, fileName, inputStream, objectMetadata)
.withCannedAcl(CannedAccessControlList.PublicRead));
} catch (IOException e) {
throw new IllegalArgumentException();
Expand Down

0 comments on commit 5aba57c

Please sign in to comment.