##// END OF EJS Templates
py3: byteify the decoded JSON responses upon receipt in the LFS blobstore...
Matt Harbison -
r41474:7df10ea7 default
parent child Browse files
Show More
@@ -307,7 +307,7 b' class _gitlfsremote(object):'
307 except util.urlerr.httperror as ex:
307 except util.urlerr.httperror as ex:
308 hints = {
308 hints = {
309 400: _(b'check that lfs serving is enabled on %s and "%s" is '
309 400: _(b'check that lfs serving is enabled on %s and "%s" is '
310 'supported') % (self.baseurl, action),
310 b'supported') % (self.baseurl, action),
311 404: _(b'the "lfs.url" config may be used to override %s')
311 404: _(b'the "lfs.url" config may be used to override %s')
312 % self.baseurl,
312 % self.baseurl,
313 }
313 }
@@ -342,7 +342,12 b' class _gitlfsremote(object):'
342 separators=(r'', r': '),
342 separators=(r'', r': '),
343 sort_keys=True)))
343 sort_keys=True)))
344
344
345 return response
345 def encodestr(x):
346 if isinstance(x, pycompat.unicode):
347 return x.encode(u'utf-8')
348 return x
349
350 return pycompat.rapply(encodestr, response)
346
351
347 def _checkforservererror(self, pointers, responses, action):
352 def _checkforservererror(self, pointers, responses, action):
348 """Scans errors from objects
353 """Scans errors from objects
@@ -410,12 +415,11 b' class _gitlfsremote(object):'
410 See https://github.com/git-lfs/git-lfs/blob/master/docs/api/\
415 See https://github.com/git-lfs/git-lfs/blob/master/docs/api/\
411 basic-transfers.md
416 basic-transfers.md
412 """
417 """
413 oid = pycompat.bytestr(obj['oid'])
418 oid = obj[b'oid']
419 href = obj[b'actions'][action].get(b'href')
420 headers = obj[b'actions'][action].get(b'header', {}).items()
414
421
415 href = pycompat.bytestr(obj['actions'][action].get('href'))
422 request = util.urlreq.request(pycompat.strurl(href))
416 headers = obj['actions'][action].get('header', {}).items()
417
418 request = util.urlreq.request(href)
419 if action == b'upload':
423 if action == b'upload':
420 # If uploading blobs, read data from local blobstore.
424 # If uploading blobs, read data from local blobstore.
421 if not localstore.verify(oid):
425 if not localstore.verify(oid):
@@ -426,7 +430,7 b' class _gitlfsremote(object):'
426 request.add_header(r'Content-Type', r'application/octet-stream')
430 request.add_header(r'Content-Type', r'application/octet-stream')
427
431
428 for k, v in headers:
432 for k, v in headers:
429 request.add_header(k, v)
433 request.add_header(pycompat.strurl(k), pycompat.strurl(v))
430
434
431 response = b''
435 response = b''
432 try:
436 try:
General Comments 0
You need to be logged in to leave comments. Login now