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'}