From 6dc8be25b0fff4f0183c518c0daadc38661a61de Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 20 Jul 2010 12:56:04 -0400 Subject: [PATCH] Use 'raw' and 'tag' for the dir roots, to avoid exposing the underlying path. For example: root=/home/user/path/to/pics may be a bit personal. Also use raw paths in previews since they are the only ones available under static/. --- dirtag/web.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dirtag/web.py b/dirtag/web.py index 59063ec..abbbcfd 100755 --- a/dirtag/web.py +++ b/dirtag/web.py @@ -78,9 +78,12 @@ class WebInterface: % (' '*(4*len(node)-2), self._dir_html_link(node, data))) def _dir_html_link(self, node, data): + root = 'raw' + if node.root == self.dirtag.tag_dir: + root = 'tag' return ('%s' % ('dir?%s' % urlencode({ - 'root':node.root, + 'root':root, 'selected':'/'.join(node), }), '/'.join(node))) @@ -114,7 +117,7 @@ class WebInterface: style = 'style="height=200px; width=200px;"' type,encoding = guess_type(node[-1]) return ('' - % (style, '/'.join(node))) + % (style, '/'.join(self.dirtag.raw_node(node)))) #elif node[-1].endswith('.jpg'): # return ('' # % (style, '/'.join(node))) @@ -135,10 +138,10 @@ class WebInterface: ) def _selected_dir(self, root, selected): - if root == self.dirtag.raw_dir: + if root == 'raw': tree = dir_tree(self.dirtag.raw_dir) else: - assert root == self.dirtag.tag_dir, root + assert root == 'tag', root tree = dir_tree(self.dirtag.tag_dir) s = None for node in tree.traverse(depth=1, type='dirs'): -- 2.26.2