Skip to content

Commit 0b3a9c4

Browse files
authored
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
1 parent 0e304bb commit 0b3a9c4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/lfs/server.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ func BatchHandler(ctx *context.Context) {
307307
continue
308308
}
309309

310+
if requireWrite && setting.LFS.MaxFileSize > 0 && object.Size > setting.LFS.MaxFileSize {
311+
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)
312+
writeStatus(ctx, 413)
313+
return
314+
}
315+
310316
// Object is not found
311317
meta, err = models.NewLFSMetaObject(&models.LFSMetaObject{Oid: object.Oid, Size: object.Size, RepositoryID: repository.ID})
312318
if err == nil {

0 commit comments

Comments
 (0)