feat: select encoding for decompressing zip file

This commit is contained in:
HFO4
2022-04-25 18:07:47 +08:00
parent cb51046305
commit 86876a1c11
3 changed files with 14 additions and 11 deletions

View File

@@ -20,8 +20,9 @@ type DecompressTask struct {
// DecompressProps 压缩任务属性
type DecompressProps struct {
Src string `json:"src"`
Dst string `json:"dst"`
Src string `json:"src"`
Dst string `json:"dst"`
Encoding string `json:"encoding"`
}
// Props 获取任务属性
@@ -82,7 +83,7 @@ func (job *DecompressTask) Do() {
job.TaskModel.SetProgress(DecompressingProgress)
err = fs.Decompress(context.Background(), job.TaskProps.Src, job.TaskProps.Dst, "")
err = fs.Decompress(context.Background(), job.TaskProps.Src, job.TaskProps.Dst, job.TaskProps.Encoding)
if err != nil {
job.SetErrorMsg("解压缩失败", err)
return
@@ -91,12 +92,13 @@ func (job *DecompressTask) Do() {
}
// NewDecompressTask 新建压缩任务
func NewDecompressTask(user *model.User, src, dst string) (Job, error) {
func NewDecompressTask(user *model.User, src, dst, encoding string) (Job, error) {
newTask := &DecompressTask{
User: user,
TaskProps: DecompressProps{
Src: src,
Dst: dst,
Src: src,
Dst: dst,
Encoding: encoding,
},
}