From 73b94e902d8fd7c6936728d00e1229b321c69327 Mon Sep 17 00:00:00 2001 From: kkocdko <31189892+kkocdko@users.noreply.github.com> Date: Sun, 9 Oct 2022 19:44:10 +0800 Subject: [PATCH] fix xhtml pages' `content-disposition` (#2903) Co-authored-by: Yuki Okushi --- actix-files/CHANGES.md | 2 ++ actix-files/src/named.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/actix-files/CHANGES.md b/actix-files/CHANGES.md index a71bf14fa..6e57bf7a7 100644 --- a/actix-files/CHANGES.md +++ b/actix-files/CHANGES.md @@ -1,8 +1,10 @@ # Changes ## Unreleased - 2022-xx-xx +- XHTML files now use `Content-Disposition: inline` instead of `attachment`. [#2903] - Minimum supported Rust version (MSRV) is now 1.59 due to transitive `time` dependency. +[#2903]: https://github.com/actix/actix-web/pull/2903 ## 0.6.2 - 2022-07-23 - Allow partial range responses for video content to start streaming sooner. [#2817] diff --git a/actix-files/src/named.rs b/actix-files/src/named.rs index 1213534c2..23d3093dc 100644 --- a/actix-files/src/named.rs +++ b/actix-files/src/named.rs @@ -132,7 +132,7 @@ impl NamedFile { mime::IMAGE | mime::TEXT | mime::AUDIO | mime::VIDEO => DispositionType::Inline, mime::APPLICATION => match ct.subtype() { mime::JAVASCRIPT | mime::JSON => DispositionType::Inline, - name if name == "wasm" => DispositionType::Inline, + name if name == "wasm" || name == "xhtml" => DispositionType::Inline, _ => DispositionType::Attachment, }, _ => DispositionType::Attachment,