Skip to content

Commit ce6ed00

Browse files
committed
fix: image resolver
1 parent 74fa1c5 commit ce6ed00

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/routes.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,6 @@ async fn proxy_for_transform(
211211
depot: &mut Depot,
212212
ctrl: &mut FlowCtrl,
213213
) -> Result<(), anyhow::Error> {
214-
dbg!(&req);
215-
let config: Config = Config::dynamic(req).extract().unwrap();
216-
let content_type = get_content_type_from_headers(req.headers_mut());
217214
let proxy = default_proxy();
218215
let headers_ori = req.headers().clone();
219216
req.headers_mut().insert(http::header::ACCEPT, header::HeaderValue::from_static("application/json"));
@@ -524,13 +521,14 @@ pub async fn direct_stream_fallback(
524521
return Ok(());
525522
}
526523

527-
proxy_for_transform.handle(req, depot, res, ctrl).await;
524+
let mut res_upstream = &mut Response::new();
525+
proxy_for_transform.handle(req, depot, res_upstream, ctrl).await;
528526

529-
match res.status_code.unwrap() {
527+
match res_upstream.status_code.unwrap() {
530528
http::StatusCode::OK => {
531529
let container: MediaContainerWrapper<MediaContainer> =
532530
//from_reqwest_response(upstream_res).await?;
533-
from_salvo_response(res).await?;
531+
from_salvo_response(res_upstream).await?;
534532

535533
if container.media_container.general_decision_code.is_some()
536534
&& container.media_container.general_decision_code.unwrap() == 2000
@@ -552,13 +550,13 @@ pub async fn direct_stream_fallback(
552550
//return Ok(());
553551
},
554552
status => {
555-
tracing::error!(status = ?status, res = ?res, "Failed to get plex response");
553+
tracing::error!(status = ?status, res = ?res_upstream, "Failed to get plex response");
556554
return Err(
557555
salvo::http::StatusError::internal_server_error().into()
558556
);
559557
}
560558
};
561-
559+
//res = &mut Response::new();
562560
return Ok(());
563561
}
564562

0 commit comments

Comments
 (0)