π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[server] Limit copying max 100 files in single req
Neeraj Guptad0621eea3e2b
diff --git a/server/pkg/api/file.go b/server/pkg/api/file.goindex 6bda9ab31a..a253c71c2a 100644--- a/server/pkg/api/file.go+++ b/server/pkg/api/file.go@@ -1,6 +1,7 @@package apiimport (+ "fmt""github.com/ente-io/museum/pkg/controller/file_copy""net/http""os"@@ -27,6 +28,7 @@ type FileHandler struct {// DefaultMaxBatchSize is the default maximum API batch size unless specified otherwiseconst DefaultMaxBatchSize = 1000+const DefaultCopyBatchSize = 100// CreateOrUpdate creates an entry for a filefunc (h *FileHandler) CreateOrUpdate(c *gin.Context) {@@ -67,6 +69,10 @@ func (h *FileHandler) CopyFiles(c *gin.Context) {handler.Error(c, stacktrace.Propagate(err, ""))return}+ if len(req.CollectionFileItems) > DefaultCopyBatchSize {+ handler.Error(c, stacktrace.Propagate(ente.NewBadRequestWithMessage(fmt.Sprintf("more than %d items", DefaultCopyBatchSize)), ""))+ return+ }response, err := h.FileCopyCtrl.CopyFiles(c, req)if err != nil {handler.Error(c, stacktrace.Propagate(err, ""))diff --git a/server/pkg/controller/file_copy/file_copy.go b/server/pkg/controller/file_copy/file_copy.goindex 7c50e1c3ac..afab10efee 100644--- a/server/pkg/controller/file_copy/file_copy.go+++ b/server/pkg/controller/file_copy/file_copy.go@@ -17,6 +17,8 @@ import ("time")+const ()+type FileCopyController struct {S3Config *s3config.S3ConfigFileController *controller.FileController