diff --git a/viewer/helpers.py b/viewer/helpers.py index 02cf123..101871b 100644 --- a/viewer/helpers.py +++ b/viewer/helpers.py @@ -1,5 +1,5 @@ import os -from typing import Tuple, List +from typing import List, Tuple def extra_listdir(path: str) -> List[Tuple[str, str]]: @@ -9,7 +9,14 @@ def extra_listdir(path: str) -> List[Tuple[str, str]]: :param path: The path to the directory. :return: A list of tuples, each containing two strings, the file or directory name, and the media type. """ - return [(file, get_all_mediatype(file, path)) for file in os.listdir(path)] + files = [] + for file in os.listdir(path): + mediatype = get_all_mediatype(file, path) + if mediatype == 'folder': + files.append((file, mediatype, os.path.join(path, file))) + else: + files.append((file, mediatype)) + return files def get_all_mediatype(head: str, tail: str) -> str: diff --git a/viewer/templates/add.html b/viewer/templates/add.html index 6d69511..f5d8de9 100644 --- a/viewer/templates/add.html +++ b/viewer/templates/add.html @@ -22,7 +22,7 @@