Skip to content

Commit

Permalink
Fix image upload extension checking
Browse files Browse the repository at this point in the history
  • Loading branch information
gousaiyang committed May 23, 2018
1 parent 43b901e commit d7a9840
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/bookstore/action/UploadImageAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public String execute() {
return LOGIN;
}

List<String> allowedExtensions = Arrays.asList(".jpg", ".jpeg", ".png", ".bmp", ".gif");
if (allowedExtensions.indexOf(FilenameUtils.getExtension(filename)) == -1) {
List<String> allowedExtensions = Arrays.asList("jpg", "jpeg", "png", "bmp", "gif");
if (allowedExtensions.indexOf(FilenameUtils.getExtension(filename).toLowerCase()) == -1) {
retJson = new FailureMessage("上传失败!仅支持 JPG、PNG、BMP、GIF 图片格式!");
return ERROR;
}
Expand Down

0 comments on commit d7a9840

Please sign in to comment.