diff --git a/src/files.rs b/src/files.rs index d7ea0dd..85a865c 100644 --- a/src/files.rs +++ b/src/files.rs @@ -1,4 +1,3 @@ - use std::fmt::Debug; use std::fs::read_dir; use std::io; @@ -38,7 +37,7 @@ pub async fn list_photos( // Do we need this? if let (Some(tag_ids), Some(filter_mode)) = (&req.tag_ids, &req.tag_filter_mode) { let search_recursively = &req.recursive.unwrap_or(false); - if *filter_mode == FilterMode::All { + if search_recursively { let mut dao = tag_dao.lock().expect("Unable to get TagDao"); let tag_ids = tag_ids .split(',') @@ -50,12 +49,7 @@ pub async fn list_photos( .context(format!("Failed to get files with tag_ids: {:?}", tag_ids)) .map(|tagged_files| { HttpResponse::Ok().json(PhotosResponse { - photos: tagged_files.iter().filter(|&file_path| { - let slash_count = file_path.split('/').count(); - let search_path_slash_count = path.split('/').count(); - - slash_count > search_path_slash_count - }).map(|p| p.clone()).collect::>(), + photos: tagged_files, dirs: vec![], }) })