From dcd312b9fbd902b7dc5f945a32f7c3db9bfd5fa9 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Fri, 13 Sep 2013 11:39:13 +0100 Subject: [PATCH] Fix tree link on layer list for layers with no subdirectory We always need to replace %path% in the URL, not just when there is a non-blank path to replace it with. Signed-off-by: Paul Eggleton --- layerindex/models.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/layerindex/models.py b/layerindex/models.py index 5e38285..e1a9edd 100644 --- a/layerindex/models.py +++ b/layerindex/models.py @@ -143,10 +143,9 @@ class LayerBranch(models.Model): if '%path%' in base_url: if extra_path: url = re.sub(r'\[([^\]]*%path%[^\]]*)\]', '\\1', url) - return url.replace('%path%', extra_path) else: url = re.sub(r'\[([^\]]*%path%[^\]]*)\]', '', url) - return url + return url.replace('%path%', extra_path) else: return url + extra_path return None