aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
authorPeter <peter.kurfer@googlemail.com>2023-03-12 08:48:07 +0100
committerGitHub <noreply@github.com>2023-03-12 03:48:07 -0400
commitc6f50297084ebd9ec8b8c25370b9b963167274eb (patch)
tree505bc97acfadf318fd947e70f0ec4bae4ccbcc3e /routers/web
parent023521b016d004ca185f0c4e2d80d30e2722fa81 (diff)
downloadgitea-c6f50297084ebd9ec8b8c25370b9b963167274eb.tar.gz
gitea-c6f50297084ebd9ec8b8c25370b9b963167274eb.zip
Preserve file size when creating attachments (#23406)
When creating attachments (issue, release, repo) the file size (being part of the multipart file header) is passed through the chain of creating an attachment to ensure the MinIO client can stream the file directly instead of having to read it to memory completely at first. Fixes #23393 Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/repo/attachment.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/web/repo/attachment.go b/routers/web/repo/attachment.go
index 589632ad6e..c6d8828fac 100644
--- a/routers/web/repo/attachment.go
+++ b/routers/web/repo/attachment.go
@@ -44,7 +44,7 @@ func uploadAttachment(ctx *context.Context, repoID int64, allowedTypes string) {
}
defer file.Close()
- attach, err := attachment.UploadAttachment(file, allowedTypes, &repo_model.Attachment{
+ attach, err := attachment.UploadAttachment(file, allowedTypes, header.Size, &repo_model.Attachment{
Name: header.Filename,
UploaderID: ctx.Doer.ID,
RepoID: repoID,