Standardize path for list directory api call. #3487

This commit is contained in:
Ruud
2014-06-23 13:43:33 +02:00
parent a37517bf6a
commit 28ffad10ab
+2
View File
@@ -3,6 +3,7 @@ import os
import string import string
from couchpotato.api import addApiView from couchpotato.api import addApiView
from couchpotato.core.helpers.encoding import sp
from couchpotato.core.helpers.variable import getUserDir from couchpotato.core.helpers.variable import getUserDir
from couchpotato.core.plugins.base import Plugin from couchpotato.core.plugins.base import Plugin
import six import six
@@ -50,6 +51,7 @@ class FileBrowser(Plugin):
path = '/' path = '/'
dirs = [] dirs = []
path = sp(path)
for f in os.listdir(path): for f in os.listdir(path):
p = os.path.join(path, f) p = os.path.join(path, f)
if os.path.isdir(p) and ((self.is_hidden(p) and bool(int(show_hidden))) or not self.is_hidden(p)): if os.path.isdir(p) and ((self.is_hidden(p) and bool(int(show_hidden))) or not self.is_hidden(p)):