|
@@ -69,6 +69,10 @@ func UploadFile(code, fileName, url string, bt []byte) (string, string, string,
|
|
|
} else {
|
|
|
newFileType = util.GetFileType(bt)
|
|
|
}
|
|
|
+ //newFileType字节解析出来的文件类型不是常见类型时,替换成oldFileType
|
|
|
+ if newFileType != oldFileType && !commUsedReg.MatchString(newFileType) && oldFileType != "" {
|
|
|
+ newFileType = oldFileType
|
|
|
+ }
|
|
|
//禁止上传
|
|
|
if filterTypeReg.MatchString(newFileType) {
|
|
|
if oldFileType != "doc" && oldFileType != "docx" {
|
|
@@ -79,10 +83,6 @@ func UploadFile(code, fileName, url string, bt []byte) (string, string, string,
|
|
|
newFileType = oldFileType
|
|
|
}
|
|
|
}
|
|
|
- //newFileType字节解析出来的文件类型不是常见类型时,替换成oldFileType
|
|
|
- if newFileType != oldFileType && !commUsedReg.MatchString(newFileType) && oldFileType != "" {
|
|
|
- newFileType = oldFileType
|
|
|
- }
|
|
|
if oldFileType != "" {
|
|
|
fileName = name + "." + oldFileType
|
|
|
} else if newFileType != "" {
|