From ed5afd667c1e02df9cc713097aee81a01d854675 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 29 Apr 2013 15:36:11 +0200 Subject: [PATCH] volume prefix should always end with / --- pandora_client/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index 8058b46..32020f8 100644 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -381,7 +381,7 @@ class Client(object): name = args[0] path = args[1] if not path.endswith('/'): - path = path+'/' + path += '/' if os.path.isdir(path): if name in self._config['volumes']: print "updated %s to %s" % (name, path) @@ -466,7 +466,8 @@ class Client(object): for name in self._config['volumes']: path = self._config['volumes'][name] path = os.path.normpath(path) - + if not path.endswith('/'): + path += '/' if os.path.exists(path): files += self.files(path)['info'] else: @@ -644,6 +645,8 @@ class Client(object): def files(self, prefix): + if not prefix.endswith('/'): + prefix += '/' conn, c = self._conn() files = {} files['info'] = {} @@ -661,7 +664,7 @@ class Client(object): files['info'][oshash] = info files['files'].append({ 'oshash': oshash, - 'path': path[len(prefix)+1:], + 'path': path[len(prefix):], 'atime': row[3], 'ctime': row[4], 'mtime': row[5],