Skip to content

Commit

Permalink
refactor(AwsS3Uploader) : s3 파일 업로드시 파일 확장자 jpg 허용 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
mjj111 committed Jun 30, 2024
1 parent 868ca70 commit 74ba549
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/com/aliens/backend/uploader/AwsS3Uploader.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class AwsS3Uploader {
private static final String PNJ_FILE_EXTENSION = "png";
private static final String JPEG_FILE_EXTENSION = "jpeg";
private static final String GIF_FILE_EXTENSION = "gif";
private static final String JPG_FILE_EXTENSION = "jpg";
private static final int MAX_UPLOADS = 2;
private static final long MAX_IMAGE_SIZE = 10 * 1024 * 1024; // 10 MB

Expand Down Expand Up @@ -75,7 +76,9 @@ private void checkFilesImage(final MultipartFile multipartFile) {
String extension = StringUtils.getFilenameExtension(multipartFile.getOriginalFilename());
if (!extension.equalsIgnoreCase(PNJ_FILE_EXTENSION)
&& !extension.equalsIgnoreCase(JPEG_FILE_EXTENSION)
&& !extension.equalsIgnoreCase(GIF_FILE_EXTENSION)) {
&& !extension.equalsIgnoreCase(GIF_FILE_EXTENSION)
&& !extension.equalsIgnoreCase(JPG_FILE_EXTENSION)
) {
throw new RestApiException(BoardError.POST_IMAGE_ERROR);
}
}
Expand Down

0 comments on commit 74ba549

Please sign in to comment.