Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.21.12.1^2
zouap 4 years ago
parent
commit
f6d5794094
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      routers/repo/ai_model_manage.go

+ 8
- 4
routers/repo/ai_model_manage.go View File

@@ -187,11 +187,12 @@ func DownloadMultiModelFile(ctx *context.Context) {
return
}
path := Model_prefix + models.AttachmentRelativePath(id) + "/"
returnFileName := task.Name + "_" + task.Version + ".zip"
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+returnFileName)
ctx.Resp.Header().Set("Content-Type", "application/octet-stream")

allFile, err := storage.GetAllObjectByBucketAndPrefix(setting.Bucket, path)
if err != nil {
if err == nil {
returnFileName := task.Name + "_" + task.Version + ".zip"
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+returnFileName)
ctx.Resp.Header().Set("Content-Type", "application/octet-stream")
w := zip.NewWriter(ctx.Resp)
defer w.Close()
for _, oneFile := range allFile {
@@ -228,6 +229,9 @@ func DownloadMultiModelFile(ctx *context.Context) {
}
}
}
} else {
log.Info("error,msg=" + err.Error())
ctx.ServerError("no file to download.", err)
}
}



Loading…
Cancel
Save