style: 错误信息英文返回-framework模块
This commit is contained in:
@@ -73,13 +73,13 @@ func generateFileName(fileName string) string {
|
||||
func isAllowWrite(fileName string, allowExts []string, fileSize int64) error {
|
||||
// 判断上传文件名称长度
|
||||
if len(fileName) > DEFAULT_FILE_NAME_LENGTH {
|
||||
return fmt.Errorf("The maximum length limit for uploading file names is %d", DEFAULT_FILE_NAME_LENGTH)
|
||||
return fmt.Errorf("the maximum length limit for uploading file names is %d", DEFAULT_FILE_NAME_LENGTH)
|
||||
}
|
||||
|
||||
// 最大上传文件大小
|
||||
maxFileSize := uploadFileSize()
|
||||
if fileSize > maxFileSize {
|
||||
return fmt.Errorf("Maximum upload file size %s", parse.Bit(float64(maxFileSize)))
|
||||
return fmt.Errorf("maximum upload file size %s", parse.Bit(float64(maxFileSize)))
|
||||
}
|
||||
|
||||
// 判断文件拓展是否为允许的拓展类型
|
||||
@@ -95,7 +95,7 @@ func isAllowWrite(fileName string, allowExts []string, fileSize int64) error {
|
||||
}
|
||||
}
|
||||
if !hasExt {
|
||||
return fmt.Errorf("The upload file type is not supported, only the following types are supported:%s", strings.Join(allowExts, ","))
|
||||
return fmt.Errorf("the upload file type is not supported, only the following types are supported: %s", strings.Join(allowExts, ","))
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -107,7 +107,7 @@ func isAllowWrite(fileName string, allowExts []string, fileSize int64) error {
|
||||
func isAllowRead(filePath string) error {
|
||||
// 禁止目录上跳级别
|
||||
if strings.Contains(filePath, "..") {
|
||||
return fmt.Errorf("Prohibit jumping levels on the directory")
|
||||
return fmt.Errorf("prohibit jumping levels on the directory")
|
||||
}
|
||||
|
||||
// 检查允许下载的文件规则
|
||||
@@ -120,7 +120,7 @@ func isAllowRead(filePath string) error {
|
||||
}
|
||||
}
|
||||
if !hasExt {
|
||||
return fmt.Errorf("Rules for illegally downloaded files: %s", fileExt)
|
||||
return fmt.Errorf("rules for illegally downloaded files: %s", fileExt)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user