Fix resource URLs for files in folders

This commit is contained in:
Gina Häußge 2016-07-08 10:42:50 +02:00
parent 0015d844a8
commit 2e8d104864
2 changed files with 7 additions and 3 deletions

View file

@ -490,9 +490,13 @@ class LocalFileStorage(StorageInterface):
def list_files(self, path=None, filter=None, recursive=True):
if path:
path = self.sanitize_path(path)
base = self.path_in_storage(path)
if base:
base += "/"
else:
path = self.basefolder
return self._list_folder(path, filter=filter, recursive=recursive)
base = ""
return self._list_folder(path, base=base, filter=filter, recursive=recursive)
def add_folder(self, path, ignore_existing=True):
path, name = self.sanitize(path)

View file

@ -138,8 +138,8 @@ def _getFileList(origin, path=None, filter=None, recursive=False):
file_or_folder.update({
"refs": {
"resource": url_for(".readGcodeFile", target=FileDestinations.LOCAL, filename=path + file_or_folder["name"], _external=True),
"download": url_for("index", _external=True) + "downloads/files/" + FileDestinations.LOCAL + "/" + path + file_or_folder["name"]
"resource": url_for(".readGcodeFile", target=FileDestinations.LOCAL, filename=file_or_folder["path"], _external=True),
"download": url_for("index", _external=True) + "downloads/files/" + FileDestinations.LOCAL + "/" + file_or_folder["path"]
}
})