Create file metadata endpoint
This allows retrieving create/modify date as well as file size for any file in the BASE_PATH.
This commit is contained in:
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
|
||||
|
||||
use path_absolutize::*;
|
||||
|
||||
pub fn list_files(dir: PathBuf) -> io::Result<Vec<PathBuf>> {
|
||||
pub fn list_files(dir: &Path) -> io::Result<Vec<PathBuf>> {
|
||||
let files = read_dir(dir)?
|
||||
.map(|res| res.unwrap())
|
||||
.filter(|entry| is_image_or_video(&entry.path()) || entry.file_type().unwrap().is_dir())
|
||||
@@ -151,6 +151,13 @@ mod tests {
|
||||
assert!(is_image_or_video(Path::new("image.MoV")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nef_valid_extension_test() {
|
||||
assert!(is_image_or_video(Path::new("image.nef")));
|
||||
assert!(is_image_or_video(Path::new("image.NEF")));
|
||||
assert!(is_image_or_video(Path::new("image.NeF")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hidden_file_not_valid_test() {
|
||||
assert!(!is_image_or_video(Path::new(".DS_store")));
|
||||
|
||||
Reference in New Issue
Block a user