Merge pull request #1947 from radfish/PR-py3--cryptmsg-base64-type
CryptMessage: base64 arg type byte-array; File: set error message before use
This commit is contained in:
commit
dd9ccfa3d2
2 changed files with 3 additions and 2 deletions
|
@ -75,7 +75,7 @@ class UiWebsocketPlugin(object):
|
||||||
if text:
|
if text:
|
||||||
encrypted = pyelliptic.Cipher(key, iv, 1, ciphername='aes-256-cbc').ciphering(text.encode("utf8"))
|
encrypted = pyelliptic.Cipher(key, iv, 1, ciphername='aes-256-cbc').ciphering(text.encode("utf8"))
|
||||||
else:
|
else:
|
||||||
encrypted = ""
|
encrypted = b""
|
||||||
|
|
||||||
res = [base64.b64encode(item).decode("utf8") for item in [key, iv, encrypted]]
|
res = [base64.b64encode(item).decode("utf8") for item in [key, iv, encrypted]]
|
||||||
self.response(to, res)
|
self.response(to, res)
|
||||||
|
|
|
@ -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