feat: add folder uploads and archives with simpler account and plan forms

This commit is contained in:
canglan committed 2026-11-15 18:57:02 +08:00
1 parent 9afd7d0067
commit faaa614cee
41 files changed
+1027 -71

No files matched your search

+7 -3
View File
@@ -185,14 +185,18 @@ func (s *Server) downloadFile(w http.ResponseWriter, r *http.Request, root *node
}
func (s *Server) uploadFile(w http.ResponseWriter, r *http.Request, tenantID uint64, root string) {
r.Body = http.MaxBytesReader(w, r.Body, s.cfg.UploadLimitBytes+1<<20)
if err := r.ParseMultipartForm(s.cfg.UploadLimitBytes); err != nil {
writeError(w, http.StatusRequestEntityTooLarge, uploadLimitMessage(s.cfg.UploadLimitBytes))
r.Body = http.MaxBytesReader(w, r.Body, batchUploadLimit+1<<20)
if err := r.ParseMultipartForm(1 << 20); err != nil {
writeError(w, http.StatusRequestEntityTooLarge, "上传请求过大:单批总量不超过 30 MB,单文件不超过 20 MB")
return
}
if r.MultipartForm != nil {
defer r.MultipartForm.RemoveAll()
}
if r.FormValue("batch") == "true" || len(r.MultipartForm.File["file"]) > 1 {
s.uploadBatchFiles(w, r, tenantID, root)
return
}
source, header, err := r.FormFile("file")
if err != nil {
writeError(w, http.StatusBadRequest, "缺少上传文件")