Wait for user's content.json on file request

This commit is contained in:
ZeroNet 2016-08-10 12:41:35 +02:00
parent e5e76a4ef5
commit 44dc4c41c9

View file

@ -552,14 +552,20 @@ class Site(object):
if not self.content_manager.contents.get("content.json"): if not self.content_manager.contents.get("content.json"):
return False # Content.json download failed return False # Content.json download failed
if not inner_path.endswith("content.json") and not self.content_manager.getFileInfo(inner_path): if not inner_path.endswith("content.json"):
file_info = self.content_manager.getFileInfo(inner_path)
if not file_info:
# No info for file, download all content.json first # No info for file, download all content.json first
self.log.debug("No info for %s, waiting for all content.json" % inner_path) self.log.debug("No info for %s, waiting for all content.json" % inner_path)
success = self.downloadContent("content.json", download_files=False) success = self.downloadContent("content.json", download_files=False)
if not success: if not success:
return False return False
if not self.content_manager.getFileInfo(inner_path): file_info = self.content_manager.getFileInfo(inner_path)
if not file_info:
return False # Still no info for file return False # Still no info for file
if "cert_signers" in file_info and not file_info["content_inner_path"] in self.content_manager.contents:
self.log.debug("Missing content.json for requested user file: %s" % inner_path)
self.downloadContent(file_info["content_inner_path"], download_files=False)
task = self.worker_manager.addTask(inner_path, peer, priority=priority) task = self.worker_manager.addTask(inner_path, peer, priority=priority)
if blocking: if blocking: