Skip to content

Commit

Permalink
refactor(File): 파일명 검사 로직 강화
Browse files Browse the repository at this point in the history
  • Loading branch information
limehee committed Oct 1, 2024
1 parent f3d5be8 commit 6549677
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/com/stempo/api/global/util/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ public static void validateFileAttributes(String originalFilename, Set<String> d
* @return 유효한 파일명일 경우 true, 그렇지 않을 경우 false
*/
private static boolean validateFilename(String fileName) {
return fileName != null && !fileName.trim().isEmpty();
if (fileName == null || fileName.trim().isEmpty()) {
return false;
}
return !fileName.contains("..") && !fileName.contains("/") && !fileName.contains("\\");
}

/**
Expand Down

0 comments on commit 6549677

Please sign in to comment.