summaryrefslogtreecommitdiffstats
path: root/modules/lfs
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-03-03 20:57:27 +0000
committerGitHub <noreply@github.com>2020-03-03 14:57:27 -0600
commit0b3a9c4f851fe7302bbbab91721fd2e641a4ed22 (patch)
tree3905bc39b4985626992f8320c44d50ee2695afd7 /modules/lfs
parent0e304bbc4204ca0db680bd30e2ede27627355665 (diff)
downloadgitea-0b3a9c4f851fe7302bbbab91721fd2e641a4ed22.tar.gz
gitea-0b3a9c4f851fe7302bbbab91721fd2e641a4ed22.zip
Fix LFS max file size enforcement (#10593)
Unfortunately the batch handler also needs to enforce max file size. Enforce max file size in batch handler
Diffstat (limited to 'modules/lfs')
-rw-r--r--modules/lfs/server.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/lfs/server.go b/modules/lfs/server.go
index d6798ec4f5..5899f4dfce 100644
--- a/modules/lfs/server.go
+++ b/modules/lfs/server.go
@@ -307,6 +307,12 @@ func BatchHandler(ctx *context.Context) {
continue
}
+ if requireWrite && setting.LFS.MaxFileSize > 0 && object.Size > setting.LFS.MaxFileSize {
+ log.Info("Denied LFS upload of size %d to %s/%s because of LFS_MAX_FILE_SIZE=%d", object.Size, object.User, object.Repo, setting.LFS.MaxFileSize)
+ writeStatus(ctx, 413)
+ return
+ }
+
// Object is not found
meta, err = models.NewLFSMetaObject(&models.LFSMetaObject{Oid: object.Oid, Size: object.Size, RepositoryID: repository.ID})
if err == nil {