##// END OF EJS Templates
py3: add b'' prefixes to the LFS server module...
Matt Harbison -
r41469:7a11e4e5 default
parent child Browse files
Show More
@@ -43,7 +43,7 b' def handlewsgirequest(orig, rctx, req, r'
43 if orig(rctx, req, res, checkperm):
43 if orig(rctx, req, res, checkperm):
44 return True
44 return True
45
45
46 if not rctx.repo.ui.configbool('experimental', 'lfs.serve'):
46 if not rctx.repo.ui.configbool(b'experimental', b'lfs.serve'):
47 return False
47 return False
48
48
49 if not util.safehasattr(rctx.repo.svfs, 'lfslocalblobstore'):
49 if not util.safehasattr(rctx.repo.svfs, 'lfslocalblobstore'):
@@ -54,7 +54,7 b' def handlewsgirequest(orig, rctx, req, r'
54
54
55 try:
55 try:
56 if req.dispatchpath == b'.git/info/lfs/objects/batch':
56 if req.dispatchpath == b'.git/info/lfs/objects/batch':
57 checkperm(rctx, req, 'pull')
57 checkperm(rctx, req, b'pull')
58 return _processbatchrequest(rctx.repo, req, res)
58 return _processbatchrequest(rctx.repo, req, res)
59 # TODO: reserve and use a path in the proposed http wireprotocol /api/
59 # TODO: reserve and use a path in the proposed http wireprotocol /api/
60 # namespace?
60 # namespace?
@@ -81,7 +81,7 b' def _sethttperror(res, code, message=Non'
81 def _logexception(req):
81 def _logexception(req):
82 """Write information about the current exception to wsgi.errors."""
82 """Write information about the current exception to wsgi.errors."""
83 tb = pycompat.sysbytes(traceback.format_exc())
83 tb = pycompat.sysbytes(traceback.format_exc())
84 errorlog = req.rawenv[r'wsgi.errors']
84 errorlog = req.rawenv[b'wsgi.errors']
85
85
86 uri = b''
86 uri = b''
87 if req.apppath:
87 if req.apppath:
@@ -209,7 +209,7 b' def _batchresponseobjects(req, objects, '
209 # verified as the file is streamed to the caller.
209 # verified as the file is streamed to the caller.
210 try:
210 try:
211 verifies = store.verify(oid)
211 verifies = store.verify(oid)
212 if verifies and action == 'upload':
212 if verifies and action == b'upload':
213 # The client will skip this upload, but make sure it remains
213 # The client will skip this upload, but make sure it remains
214 # available locally.
214 # available locally.
215 store.linkfromusercache(oid)
215 store.linkfromusercache(oid)
@@ -228,7 +228,7 b' def _batchresponseobjects(req, objects, '
228
228
229 # Items are always listed for downloads. They are dropped for uploads
229 # Items are always listed for downloads. They are dropped for uploads
230 # IFF they already exist locally.
230 # IFF they already exist locally.
231 if action == 'download':
231 if action == b'download':
232 if not exists:
232 if not exists:
233 rsp['error'] = {
233 rsp['error'] = {
234 'code': 404,
234 'code': 404,
@@ -259,8 +259,8 b' def _batchresponseobjects(req, objects, '
259 'Accept': 'application/vnd.git-lfs'
259 'Accept': 'application/vnd.git-lfs'
260 }
260 }
261
261
262 auth = req.headers.get('Authorization', '')
262 auth = req.headers.get(b'Authorization', b'')
263 if auth.startswith('Basic '):
263 if auth.startswith(b'Basic '):
264 hdr['Authorization'] = auth
264 hdr['Authorization'] = auth
265
265
266 return hdr
266 return hdr
@@ -297,7 +297,7 b' def _processbasictransfer(repo, req, res'
297 return True
297 return True
298
298
299 if method == b'PUT':
299 if method == b'PUT':
300 checkperm('upload')
300 checkperm(b'upload')
301
301
302 # TODO: verify Content-Type?
302 # TODO: verify Content-Type?
303
303
@@ -324,7 +324,7 b' def _processbasictransfer(repo, req, res'
324
324
325 return True
325 return True
326 elif method == b'GET':
326 elif method == b'GET':
327 checkperm('pull')
327 checkperm(b'pull')
328
328
329 res.status = hgwebcommon.statusmessage(HTTP_OK)
329 res.status = hgwebcommon.statusmessage(HTTP_OK)
330 res.headers[b'Content-Type'] = b'application/octet-stream'
330 res.headers[b'Content-Type'] = b'application/octet-stream'
General Comments 0
You need to be logged in to leave comments. Login now