From d64ff3c866349fd5f4240e2fd4de7b5d0572c771 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 5 Jun 2025 14:17:46 +0000 Subject: fix(response): Always proxy images as raw bytes --- src/response.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/response.rs b/src/response.rs index 75fdb3b..1a68b08 100644 --- a/src/response.rs +++ b/src/response.rs @@ -93,6 +93,16 @@ pub async fn default( timer = Instant::now(); + if response.meta().starts_with("image/") { + if let Some(content_bytes) = &response.content_bytes() { + return Ok( + HttpResponse::build(actix_web::http::StatusCode::OK) + .content_type(response.meta().as_ref()) + .body(content_bytes.to_vec()), + ); + } + } + let mut html_context = if configuration.is_raw() { String::new() } else { -- cgit v1.2.3