MCPcopy Create free account
hub / github.com/diyhi/bbs / validateFileSuffix

Method validateFileSuffix

src/main/java/cms/utils/FileUtil.java:251–265  ·  view source on GitHub ↗

验证文件后缀 @param fileName 文件名称(含后缀) @param formatList 允许格式列表

(String fileName,List<String> formatList)

Source from the content-addressed store, hash-verified

249 * @param formatList 允许格式列表
250 */
251 public static boolean validateFileSuffix(String fileName,List<String> formatList){
252 //取得文件后缀
253 String suffix = getExtension(fileName);
254 for(String format : formatList) {
255 String[] fileType_array = format.split("/");
256 for(String fileType : fileType_array){
257 if(fileType.equalsIgnoreCase(suffix)){
258 return true;
259 }
260 }
261
262 }
263
264 return false;
265 }
266 /**
267 * 获取文件后缀名
268 * @param path 路径

Callers 15

handleFileMethod · 0.95
handleFileUploadMethod · 0.95
updateAvatarMethod · 0.95
handleCloudUploadMethod · 0.95
handleLocalUploadMethod · 0.95
handleCloudUploadMethod · 0.95
handleLocalUploadMethod · 0.95
handleCloudUploadMethod · 0.95
handleLocalUploadMethod · 0.95
addReportMethod · 0.95
updateAvatarMethod · 0.95
handleCloudUploadMethod · 0.95

Calls 1

getExtensionMethod · 0.95

Tested by

no test coverage detected