hgext/lfs/blobstore.py
changeset 44141 46c8f15fb2b4
parent 44140 b2408acaa4c9
child 44272 06de4a673f48
--- a/hgext/lfs/blobstore.py	Tue Jan 21 09:55:35 2020 -0500
+++ b/hgext/lfs/blobstore.py	Tue Jan 21 10:13:08 2020 -0500
@@ -490,15 +490,17 @@
                     _(b'detected corrupt lfs object: %s') % oid,
                     hint=_(b'run hg verify'),
                 )
-            request.data = lfsuploadfile(localstore.open(oid))
-            request.get_method = lambda: 'PUT'
-            request.add_header('Content-Type', 'application/octet-stream')
-            request.add_header('Content-Length', len(request.data))
 
         for k, v in headers:
             request.add_header(pycompat.strurl(k), pycompat.strurl(v))
 
         try:
+            if action == b'upload':
+                request.data = lfsuploadfile(localstore.open(oid))
+                request.get_method = lambda: 'PUT'
+                request.add_header('Content-Type', 'application/octet-stream')
+                request.add_header('Content-Length', len(request.data))
+
             with contextlib.closing(self.urlopener.open(request)) as res:
                 contentlength = res.info().get(b"content-length")
                 ui = self.ui  # Shorten debug lines