Catch file verification errors on update request
This commit is contained in:
parent
25657ebdca
commit
9a9bd71634
1 changed files with 6 additions and 3 deletions
|
@ -127,7 +127,11 @@ class FileRequest(object):
|
||||||
if self.server.files_parsing.get(file_uri): # Check if we already working on it
|
if self.server.files_parsing.get(file_uri): # Check if we already working on it
|
||||||
valid = None # Same file
|
valid = None # Same file
|
||||||
else:
|
else:
|
||||||
valid = site.content_manager.verifyFile(params["inner_path"], content)
|
try:
|
||||||
|
valid = site.content_manager.verifyFile(inner_path, content)
|
||||||
|
except Exception, err:
|
||||||
|
self.log.debug("Update for %s is invalid" % (inner_path, err))
|
||||||
|
valid = False
|
||||||
|
|
||||||
if valid is True: # Valid and changed
|
if valid is True: # Valid and changed
|
||||||
site.log.info("Update for %s looks valid, saving..." % inner_path)
|
site.log.info("Update for %s looks valid, saving..." % inner_path)
|
||||||
|
@ -179,8 +183,7 @@ class FileRequest(object):
|
||||||
self.connection.badAction()
|
self.connection.badAction()
|
||||||
|
|
||||||
else: # Invalid sign or sha hash
|
else: # Invalid sign or sha hash
|
||||||
self.log.debug("Update for %s is invalid" % params["inner_path"])
|
self.response({"error": "File invalid: %s" % err})
|
||||||
self.response({"error": "File invalid"})
|
|
||||||
self.connection.badAction(5)
|
self.connection.badAction(5)
|
||||||
|
|
||||||
# Send file content request
|
# Send file content request
|
||||||
|
|
Loading…
Reference in a new issue