mirror of https://github.com/fafhrd91/actix-web
Replace deprecated methods
This commit is contained in:
parent
450270476e
commit
3154bc52c4
|
@ -22,7 +22,7 @@ use bytes::Bytes;
|
||||||
use futures::future::{ok, Either, FutureResult};
|
use futures::future::{ok, Either, FutureResult};
|
||||||
use futures::{Async, Future, Poll, Stream};
|
use futures::{Async, Future, Poll, Stream};
|
||||||
use mime;
|
use mime;
|
||||||
use mime_guess::get_mime_type;
|
use mime_guess::from_ext;
|
||||||
use percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET};
|
use percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET};
|
||||||
use v_htmlescape::escape as escape_html_entity;
|
use v_htmlescape::escape as escape_html_entity;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ type HttpNewService = BoxedNewService<(), ServiceRequest, ServiceResponse, Error
|
||||||
/// the type `application/octet-stream`.
|
/// the type `application/octet-stream`.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn file_extension_to_mime(ext: &str) -> mime::Mime {
|
pub fn file_extension_to_mime(ext: &str) -> mime::Mime {
|
||||||
get_mime_type(ext)
|
from_ext(ext).first_or_octet_stream()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
|
|
@ -9,7 +9,7 @@ use std::os::unix::fs::MetadataExt;
|
||||||
|
|
||||||
use bitflags::bitflags;
|
use bitflags::bitflags;
|
||||||
use mime;
|
use mime;
|
||||||
use mime_guess::guess_mime_type;
|
use mime_guess::from_path;
|
||||||
|
|
||||||
use actix_http::body::SizedStream;
|
use actix_http::body::SizedStream;
|
||||||
use actix_web::http::header::{
|
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_() {
|
let disposition_type = match ct.type_() {
|
||||||
mime::IMAGE | mime::TEXT | mime::VIDEO => DispositionType::Inline,
|
mime::IMAGE | mime::TEXT | mime::VIDEO => DispositionType::Inline,
|
||||||
_ => DispositionType::Attachment,
|
_ => DispositionType::Attachment,
|
||||||
|
|
Loading…
Reference in New Issue