file: set error message before using it
Fixes this exception: Unhandled exception: [(<class 'UnboundLocalError'>, UnboundLocalError("local variable 'err' referenced before assignm> Traceback (most recent call last): File "src/gevent/greenlet.py", line 766, in gevent._greenlet.Greenlet.run File "/opt/zeronet/src/util/RateLimit.py", line 57, in <lambda> thread = gevent.spawn_later(time_left, lambda: callQueue(event)) # Call this function later File "/opt/zeronet/src/util/RateLimit.py", line 42, in callQueue return func(*args, **kwargs) File "/opt/zeronet/src/File/FileRequest.py", line 185, in actionUpdate self.response({"error": "File invalid: %s" % err}) UnboundLocalError: local variable 'err' referenced before assignment
This commit is contained in:
parent
65be9f438b
commit
941571f71f
1 changed files with 2 additions and 1 deletions
|
@ -133,6 +133,7 @@ class FileRequest(object):
|
||||||
valid = site.content_manager.verifyFile(inner_path, content)
|
valid = site.content_manager.verifyFile(inner_path, content)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
self.log.debug("Update for %s is invalid: %s" % (inner_path, err))
|
self.log.debug("Update for %s is invalid: %s" % (inner_path, err))
|
||||||
|
error = err
|
||||||
valid = False
|
valid = False
|
||||||
|
|
||||||
if valid is True: # Valid and changed
|
if valid is True: # Valid and changed
|
||||||
|
@ -182,7 +183,7 @@ class FileRequest(object):
|
||||||
self.connection.badAction()
|
self.connection.badAction()
|
||||||
|
|
||||||
else: # Invalid sign or sha hash
|
else: # Invalid sign or sha hash
|
||||||
self.response({"error": "File invalid: %s" % err})
|
self.response({"error": "File %s invalid: %s" % (inner_path, error)})
|
||||||
self.connection.badAction(5)
|
self.connection.badAction(5)
|
||||||
|
|
||||||
def isReadable(self, site, inner_path, file, pos):
|
def isReadable(self, site, inner_path, file, pos):
|
||||||
|
|
Loading…
Reference in a new issue