fix upload.py logging b_hash define
This commit is contained in:
parent
968f468027
commit
93d176badc
@ -36,7 +36,7 @@ def accept_upload(request):
|
|||||||
resp = 'failure'
|
resp = 'failure'
|
||||||
data = request.get_data()
|
data = request.get_data()
|
||||||
data_size = sys.getsizeof(data)
|
data_size = sys.getsizeof(data)
|
||||||
|
b_hash = None
|
||||||
if data_size < 30:
|
if data_size < 30:
|
||||||
resp = 'size'
|
resp = 'size'
|
||||||
elif data_size < 100000000:
|
elif data_size < 100000000:
|
||||||
@ -69,11 +69,11 @@ def accept_upload(request):
|
|||||||
except onionrexceptions.DataExists:
|
except onionrexceptions.DataExists:
|
||||||
resp = 'exists'
|
resp = 'exists'
|
||||||
except onionrexceptions.PlaintextNotSupported:
|
except onionrexceptions.PlaintextNotSupported:
|
||||||
logger.debug("attempted plaintext upload to us: {b_hash}")
|
logger.debug(f"attempted plaintext upload to us: {b_hash}")
|
||||||
resp = 'failure'
|
resp = 'failure'
|
||||||
except onionrexceptions.InvalidMetadata:
|
except onionrexceptions.InvalidMetadata:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
'uploaded block {b_hash} has invalid metadata')
|
f'uploaded block {b_hash} has invalid metadata')
|
||||||
resp = 'failure'
|
resp = 'failure'
|
||||||
if resp == 'failure':
|
if resp == 'failure':
|
||||||
abort(400)
|
abort(400)
|
||||||
@ -83,8 +83,12 @@ def accept_upload(request):
|
|||||||
f'Error importing uploaded block, invalid size {b_hash}')
|
f'Error importing uploaded block, invalid size {b_hash}')
|
||||||
elif resp == 'proof':
|
elif resp == 'proof':
|
||||||
resp = Response(resp, 400)
|
resp = Response(resp, 400)
|
||||||
logger.warn(
|
if b_hash:
|
||||||
f'Error importing uploaded block, invalid proof {b_hash}')
|
logger.warn(
|
||||||
|
f'Error importing uploaded block, invalid proof {b_hash}')
|
||||||
|
else:
|
||||||
|
logger.warn(
|
||||||
|
'Error importing uploaded block, invalid proof')
|
||||||
else:
|
else:
|
||||||
resp = Response(resp)
|
resp = Response(resp)
|
||||||
return resp
|
return resp
|
||||||
|
@ -1 +1 @@
|
|||||||
1606103134
|
1606975647
|
Loading…
Reference in New Issue
Block a user