-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] 파일 확장자 검증 로직 추가 #316
base: develop
Are you sure you want to change the base?
[feat] 파일 확장자 검증 로직 추가 #316
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
티카적용 확인했습니다~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
고생하셨습니다
public void isValidFileExtension(List<MultipartFile> files) { | ||
boolean isNotValid = files.stream() | ||
.anyMatch(file -> { | ||
try { | ||
List<String> extensions = mimeTypes.forName(tika.detect(file.getInputStream())).getExtensions(); | ||
return !extensions.contains("." + FilenameUtils.getExtension(file.getOriginalFilename())); | ||
} catch (MimeTypeException | IOException e) { | ||
log.error("isValidFileExtension(List)", e.getMessage()); | ||
throw new BusinessException(CommonErrorCode.FAIL_FILE_EXTENSION_VALIDATE); | ||
} | ||
}); | ||
|
||
if (isNotValid) { | ||
throw new BusinessException(CommonErrorCode.INVALID_FILE_EXTENSION); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파일 확장자와 파일 형식이 맞는지 체크하는 부분이 이 부분인가요?
💡 Motivation and Context
파일 확장자 검증 로직 추가
🔨 Modified
🌟 More
📋 커밋 전 체크리스트
🤟🏻 PR로 완료된 이슈
closes #315