mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
Replace deprecated methods in actix_files (#1027)
* Bump up mime_guess to 2.0.1 * Replace deprecated methods * Update CHANGE.md
This commit is contained in:
parent
0ee69671ba
commit
dbe4c9ffb5
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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)]
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user