diff --git a/Cargo.toml b/Cargo.toml index 61b24ad8604..338b352e548 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ os_pipe = "0.9" stderrlog = "0.4" structopt = { version = "0.3", features = ["wrap_help"] } tempfile = "3" -tree_magic = "0.2" +tree_magic_mini = "3.0.2" wayland-client = "0.27" [dependencies.wayland-protocols] diff --git a/src/copy.rs b/src/copy.rs index 5a2c0b47813..dca9f7a21a9 100644 --- a/src/copy.rs +++ b/src/copy.rs @@ -461,7 +461,14 @@ fn make_source(source: Source, } let mime_type = match mime_type { - MimeType::Autodetect => tree_magic::from_filepath(&temp_filename), + MimeType::Autodetect => match tree_magic_mini::from_filepath(&temp_filename) { + Some(magic) => Ok(magic), + None => Err(SourceCreationError::TempFileOpen(std::io::Error::new( + std::io::ErrorKind::Other, + "problem with temp file", + ))), + }? + .to_string(), MimeType::Text => "text/plain".to_string(), MimeType::Specific(mime_type) => mime_type, };