From 70ef6246a12f29918262e37a3b3277fd77cbd4c7 Mon Sep 17 00:00:00 2001 From: trivernis Date: Tue, 9 Nov 2021 19:16:48 +0100 Subject: [PATCH] Make mime type for importing files optional Signed-off-by: trivernis --- mediarepo-api/src/tauri_plugin/commands/file.rs | 6 ++---- mediarepo-api/src/types/files.rs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/mediarepo-api/src/tauri_plugin/commands/file.rs b/mediarepo-api/src/tauri_plugin/commands/file.rs index ffb1cc8..538c92f 100644 --- a/mediarepo-api/src/tauri_plugin/commands/file.rs +++ b/mediarepo-api/src/tauri_plugin/commands/file.rs @@ -175,9 +175,7 @@ async fn resolve_subdir(entry: DirEntry) -> PluginResult> { /// metadata for it #[tracing::instrument(level = "trace")] async fn retrieve_file_information(path: PathBuf) -> PluginResult { - let mime = mime_guess::from_path(&path) - .first() - .ok_or_else(|| format!("Could not guess mime for file {:?}", path))?; + let mime = mime_guess::from_path(&path).first(); let metadata = fs::metadata(&path).await?; let creation_time = metadata.created()?; let change_time = metadata.modified()?; @@ -188,7 +186,7 @@ async fn retrieve_file_information(path: PathBuf) -> PluginResult, pub creation_time: NaiveDateTime, pub change_time: NaiveDateTime, }