Skip to content

Commit

Permalink
fix: strip suffix, make huggingface happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Yazawazi committed Feb 2, 2024
1 parent cc757d0 commit f0b5b6c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use axum::{
};
use config::*;
use hyper::{header::CONTENT_TYPE, Request, StatusCode, Uri};

use state::{HyperClient, Server, ServerState};
use tokio::net::TcpListener;
use tower_http::{compression::CompressionLayer, limit::RequestBodyLimitLayer};
Expand Down Expand Up @@ -253,7 +254,12 @@ async fn reverse_proxy(
}

if !uri.path().is_empty() {
let mut new_path = uri.path().to_string();
let mut new_path = uri
.path()
.to_string()
.strip_suffix("/")
.unwrap_or_default()
.to_string();
if let Some(path) = &uri_parts.path_and_query {
new_path = format!("{new_path}{path}");
}
Expand Down

0 comments on commit f0b5b6c

Please sign in to comment.