Feat: add ".zip" suffix if not specified while creating compressed file

pull/427/head
HFO4 5 years ago
parent ee0f8e964d
commit aa3e8913ab

@ -146,6 +146,11 @@ func (service *ItemCompressService) CreateCompressTask(c *gin.Context) serialize
return serializer.Err(serializer.CodeGroupNotAllowed, "当前用户组无法进行此操作", nil) return serializer.Err(serializer.CodeGroupNotAllowed, "当前用户组无法进行此操作", nil)
} }
// 补齐压缩文件扩展名(如果没有)
if !strings.HasSuffix(service.Name, ".zip") {
service.Name += ".zip"
}
// 存放目录是否存在,是否重名 // 存放目录是否存在,是否重名
if exist, _ := fs.IsPathExist(service.Dst); !exist { if exist, _ := fs.IsPathExist(service.Dst); !exist {
return serializer.Err(serializer.CodeNotFound, "存放路径不存在", nil) return serializer.Err(serializer.CodeNotFound, "存放路径不存在", nil)

Loading…
Cancel
Save