Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-22 09:54:24 +01:00

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
This commit is contained in:
zeripath 2020-03-03 20:57:27 +00:00 committed by GitHub
parent 0e304bbc42
commit 0b3a9c4f85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {