Browse Source

download on single file directly

master
han2015 6 months ago
parent
commit
46c6941e2c
  1. 12
      code/rest/matter_service.go

12
code/rest/matter_service.go

@ -127,15 +127,17 @@ func (this *MatterService) DownloadZip(
}
}
destZipName := matters[0].Name
if len(matters) == 1 && !matters[0].Dir {
download.DownloadFile(writer, request, matters[0].AbsolutePath(), destZipName, true)
return
}
//prepare the temp zip dir
destZipDirPath := fmt.Sprintf("%s/%d", GetUserZipRootDir(matters[0].Username), time.Now().UnixNano()/1e6)
util.MakeDirAll(destZipDirPath)
destZipName := fmt.Sprintf("%s.zip", matters[0].Name)
if len(matters) > 1 || !matters[0].Dir {
destZipName = "archive.zip"
}
destZipName = "archive.zip"
destZipPath := fmt.Sprintf("%s/%s", destZipDirPath, destZipName)
this.zipMatters(request, matters, destZipPath)

Loading…
Cancel
Save