Fix recursive search at the root, cleanup video generation return

This commit is contained in:
Cameron
2024-12-06 09:47:21 -05:00
parent 8bc9c5585e
commit 787d1fd5d0
2 changed files with 20 additions and 6 deletions

View File

@@ -70,7 +70,17 @@ pub async fn list_photos<TagD: TagDao, FS: FileSystemAccess>(
.map(|tagged_files| {
tagged_files
.into_iter()
.filter(|f| f.starts_with(&format!("{}/", search_path).to_string()))
.filter(|f| {
// When searching at the root, everything matches recursively
if search_path.trim() == "" { return true; }
f.starts_with(
&format!(
"{}/",
search_path.strip_suffix('/').unwrap_or_else(|| search_path)
),
)
})
.collect::<Vec<String>>()
})
.inspect(|files| debug!("Found {:?} files", files.len()))