mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Ignoring lost+found directory.
This commit is contained in:
parent
f6ddc20f56
commit
f3f93f747a
2 changed files with 7 additions and 0 deletions
|
|
@ -87,6 +87,9 @@ def _get_directory_dict(directory: pathlib.Path, directories: List[pathlib.Path]
|
|||
return d
|
||||
|
||||
|
||||
IGNORED_DIRECTORIES = ('lost+found',)
|
||||
|
||||
|
||||
def list_directories_contents(directories_: List[str]) -> Dict:
|
||||
"""List all files down to (and within) the directories provided.
|
||||
|
||||
|
|
@ -104,6 +107,9 @@ def list_directories_contents(directories_: List[str]) -> Dict:
|
|||
|
||||
paths = dict()
|
||||
for path in media_directory.iterdir():
|
||||
if path.is_dir() and path.name in IGNORED_DIRECTORIES:
|
||||
# Never show ignored directories.
|
||||
continue
|
||||
if path.is_dir():
|
||||
paths[f'{path.name}/'] = _get_directory_dict(path, directories)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ def test_list_files_api(test_client, make_files_structure, test_directory):
|
|||
'empty directory/',
|
||||
'videos/other video.mp4',
|
||||
'videos/some video.mp4',
|
||||
'lost+found/', # Should always be ignored.
|
||||
]
|
||||
files = make_files_structure(files)
|
||||
files[0].write_text('bar contents')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue