gif passthrough

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
ゆめ 2024-11-16 07:26:41 -06:00
parent 17b015796d
commit d3ccccad2f
No known key found for this signature in database

View file

@ -198,6 +198,22 @@ where
match rs.sniffed_mime { match rs.sniffed_mime {
Some(mime) if config.normalization > NormalizationPolicy::Never => { Some(mime) if config.normalization > NormalizationPolicy::Never => {
if mime.starts_with("image/") { if mime.starts_with("image/") {
if mime.starts_with("image/gif") {
return Ok(MediaResponse::PassThru(PassThru {
header_len: header
.position()
.try_into()
.map_err(|_| ErrorResponse::payload_too_large())?,
header: Box::new(header.into_inner()),
remaining_body,
content_type: Some(mime.to_string()),
is_https,
})
.with_timing_info(TIME_TO_FIRST_BYTE_KEY, ttfb)
.with_opt_timing_info(SLURP_TIMING_KEY, None)
.with_timing_info(TIMING_KEY, begin.elapsed()));
}
if config.normalization <= NormalizationPolicy::Opportunistic if config.normalization <= NormalizationPolicy::Opportunistic
&& !options.requested_resize() && !options.requested_resize()
&& (config.normalization <= NormalizationPolicy::Lazy && (config.normalization <= NormalizationPolicy::Lazy