From 2473a09f7b45b0d1d331c52c1ae91441188fbbdf Mon Sep 17 00:00:00 2001 From: shortcutme Date: Sun, 12 Mar 2017 13:13:30 +0100 Subject: [PATCH] Load content.json content before signing --- src/Content/ContentManager.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Content/ContentManager.py b/src/Content/ContentManager.py index 4dbb2c09..be221765 100644 --- a/src/Content/ContentManager.py +++ b/src/Content/ContentManager.py @@ -503,7 +503,16 @@ class ContentManager(object): content = None if not content: # Content not exist yet, load default one self.log.info("File %s not exist yet, loading default values..." % inner_path) - content = {"files": {}, "signs": {}} # Default content.json + + if self.site.storage.isFile(inner_path): + content = self.site.storage.loadJson(inner_path) + if "files" not in content: + content["files"] = {} + if "signs" not in content: + content["signs"] = {} + else: + content = {"files": {}, "signs": {}} # Default content.json + if inner_path == "content.json": # It's the root content.json, add some more fields content["title"] = "%s - ZeroNet_" % self.site.address content["description"] = ""