# HG changeset patch # User RhodeCode Admin # Date 2024-08-28 10:28:17 # Node ID b2259b07fa200a43c0dd01071ae9e4c57f1cb908 # Parent 9241b3097fc271db098116ca0d3530b821c17b86 fix: lfs chunked uploads. When testing large file uploads it's found that gunicorn raises NoMoreData instead of returning value. This fixes the problem and doesn't show excesive exceptions for no reason. Previously file upload still worked but spawned errors in logs diff --git a/vcsserver/git_lfs/app.py b/vcsserver/git_lfs/app.py --- a/vcsserver/git_lfs/app.py +++ b/vcsserver/git_lfs/app.py @@ -18,6 +18,7 @@ import re import logging +from gunicorn.http.errors import NoMoreData from pyramid.config import Configurator from pyramid.response import Response, FileIter from pyramid.httpexceptions import ( @@ -166,9 +167,14 @@ def lfs_objects_oid_upload(request): # read in chunks as stream comes in from Gunicorn # this is a specific Gunicorn support function. # might work differently on waitress - chunk = body.read(blksize) + try: + chunk = body.read(blksize) + except NoMoreData: + chunk = None + if not chunk: break + f.write(chunk) return {'upload': 'ok'}