From 2ef537ee6ccfb93266ee62baf94adfd08c404492 Mon Sep 17 00:00:00 2001 From: shortcutme Date: Wed, 4 Oct 2017 13:24:22 +0200 Subject: [PATCH] Fox user_address detection for sub-directories in user directory --- src/Content/ContentManager.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Content/ContentManager.py b/src/Content/ContentManager.py index 2e48c459..c8c11a0f 100644 --- a/src/Content/ContentManager.py +++ b/src/Content/ContentManager.py @@ -353,7 +353,7 @@ class ContentManager(object): return False # File not found inner_path = file_info["content_inner_path"] - if inner_path == "content.json": # Root content.json + if inner_path == "content.json": # Root content.json rules = {} rules["signers"] = self.getValidSigners(inner_path, content) return rules @@ -380,7 +380,13 @@ class ContentManager(object): # Return: The rules of the file or False if not allowed def getUserContentRules(self, parent_content, inner_path, content): user_contents = parent_content["user_contents"] - user_address = re.match(".*/([A-Za-z0-9]*?)/.*?$", inner_path).group(1) # Delivered for directory + + # Delivered for directory + if "inner_path" in parent_content: + parent_content_dir = helper.getDirname(parent_content["inner_path"]) + user_address = re.match("([A-Za-z0-9]*?)/", inner_path[len(parent_content_dir):]).group(1) + else: + user_address = re.match(".*/([A-Za-z0-9]*?)/.*?$", inner_path).group(1) try: if not content: