Catch verify exceptions on manual site files verification process

This commit is contained in:
shortcutme 2017-06-19 15:57:02 +02:00
parent 7653cba247
commit ff69b04216
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -351,11 +351,16 @@ class SiteStorage(object):
if quick_check:
ok = os.path.getsize(file_path) == content["files"][file_relative_path]["size"]
if not ok:
err = "Invalid size"
else:
try:
ok = self.site.content_manager.verifyFile(file_inner_path, open(file_path, "rb"))
except Exception, err:
ok = False
if not ok:
self.log.debug("[CHANGED] %s" % file_inner_path)
self.log.debug("[INVALID] %s: %s" % (file_inner_path, err))
if add_changed or content.get("cert_user_id"): # If updating own site only add changed user files
bad_files.append(file_inner_path)
@ -377,7 +382,10 @@ class SiteStorage(object):
if quick_check:
ok = os.path.getsize(file_path) == content["files_optional"][file_relative_path]["size"]
else:
try:
ok = self.site.content_manager.verifyFile(file_inner_path, open(file_path, "rb"))
except Exception, err:
ok = False
if ok:
if not self.site.content_manager.hashfield.hasHash(file_node["sha512"]):