1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-09 16:05:20 +02:00

fix: svg files should be compressed (#3486)

* Fix svg files not being compressed

* docs: update changelog

---------

Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
Degubi 2025-05-10 05:21:36 +02:00 committed by GitHub
parent 3147aaccc7
commit 3d3b31e16a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,7 @@
- Improve handling of non-UTF-8 header values in `Logger` middleware.
- Add `HttpServer::shutdown_signal()` method.
- Mark `HttpServer` as `#[must_use]`.
- Allow SVG images to be compressed by the `Compress` middleware.
- Ignore `Host` header in `Host` guard when connection protocol is HTTP/2.
- Re-export `mime` dependency.
- Update `brotli` dependency to `8`.

View File

@ -191,8 +191,10 @@ where
None => true,
Some(hdr) => {
match hdr.to_str().ok().and_then(|hdr| hdr.parse::<Mime>().ok()) {
Some(mime) if mime.type_().as_str() == "image" => false,
Some(mime) if mime.type_().as_str() == "video" => false,
Some(mime) if mime.type_() == mime::IMAGE => {
matches!(mime.subtype(), mime::SVG)
}
Some(mime) if mime.type_() == mime::VIDEO => false,
_ => true,
}
}