diff --git a/actix-files/CHANGES.md b/actix-files/CHANGES.md index 916d579fd..8fdca4bc4 100644 --- a/actix-files/CHANGES.md +++ b/actix-files/CHANGES.md @@ -1,5 +1,9 @@ # Changes +## [0.1.5] - unreleased + +* Bump up `mime_guess` crate version to 2.0.1 + ## [0.1.4] - 2019-07-20 * Allow to disable `Content-Disposition` header #686 diff --git a/actix-files/Cargo.toml b/actix-files/Cargo.toml index 307e79060..ee2121ff9 100644 --- a/actix-files/Cargo.toml +++ b/actix-files/Cargo.toml @@ -27,7 +27,7 @@ futures = "0.1.25" derive_more = "0.15.0" log = "0.4" mime = "0.3" -mime_guess = "2.0.0-alpha" +mime_guess = "2.0.1" percent-encoding = "1.0" v_htmlescape = "0.4" diff --git a/actix-files/src/lib.rs b/actix-files/src/lib.rs index 816fd92aa..096420460 100644 --- a/actix-files/src/lib.rs +++ b/actix-files/src/lib.rs @@ -22,7 +22,7 @@ use bytes::Bytes; use futures::future::{ok, Either, FutureResult}; use futures::{Async, Future, Poll, Stream}; use mime; -use mime_guess::get_mime_type; +use mime_guess::from_ext; use percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET}; use v_htmlescape::escape as escape_html_entity; @@ -42,7 +42,7 @@ type HttpNewService = BoxedNewService<(), ServiceRequest, ServiceResponse, Error /// the type `application/octet-stream`. #[inline] pub fn file_extension_to_mime(ext: &str) -> mime::Mime { - get_mime_type(ext) + from_ext(ext).first_or_octet_stream() } #[doc(hidden)] diff --git a/actix-files/src/named.rs b/actix-files/src/named.rs index 4c80e1d96..f548a7a1b 100644 --- a/actix-files/src/named.rs +++ b/actix-files/src/named.rs @@ -9,7 +9,7 @@ use std::os::unix::fs::MetadataExt; use bitflags::bitflags; use mime; -use mime_guess::guess_mime_type; +use mime_guess::from_path; use actix_http::body::SizedStream; use actix_web::http::header::{ @@ -88,7 +88,7 @@ impl NamedFile { } }; - let ct = guess_mime_type(&path); + let ct = from_path(&path).first_or_octet_stream(); let disposition_type = match ct.type_() { mime::IMAGE | mime::TEXT | mime::VIDEO => DispositionType::Inline, _ => DispositionType::Attachment,