Skip to content

Commit

Permalink
bugfix file extenstion ignore case sensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
sjqzhang committed Oct 10, 2021
1 parent 70369c7 commit 67d036d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ const (
"support_group_manage": true,
"是否合并小文件": "默认不合并,合并可以解决inode不够用的情况(当前对于小于1M文件)进行合并",
"enable_merge_small_file": false,
"允许后缀名": "允许可以上传的文件后缀名,如jpg,jpeg,png等。留空允许所有。",
"图片是否缩放": "默认是",
"enable_image_resize": true,
"图片最大宽度": "默认值2000",
"image_max_width": 2000,
"图片最大高度": "默认值1000",
"image_max_height": 1000,
"允许后缀名": "允许可以上传的文件后缀名,如jpg,jpeg,png等。留空允许所有。",
"extensions": [],
"重试同步失败文件的时间": "单位秒",
"refresh_interval": 1800,
Expand Down
4 changes: 2 additions & 2 deletions server/http_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ func (c *Server) SaveUploadFile(file multipart.File, header *multipart.FileHeade
defer file.Close()
_, fileInfo.Name = filepath.Split(header.Filename)
// bugfix for ie upload file contain fullpath
if len(Config().Extensions) > 0 && !c.util.Contains(path.Ext(fileInfo.Name), Config().Extensions) {
if len(Config().Extensions) > 0 && !c.util.Contains(path.Ext(strings.ToLower(fileInfo.Name)), Config().Extensions) {
return fileInfo, errors.New("(error)file extension mismatch")
}
if Config().RenameFile {
Expand Down Expand Up @@ -511,4 +511,4 @@ func (c *Server) Report(w http.ResponseWriter, r *http.Request) {
} else {
w.Write([]byte(c.GetClusterNotPermitMessage(r)))
}
}
}

0 comments on commit 67d036d

Please sign in to comment.