Skip to content

Commit

Permalink
Only add base_path if req_pandq does not contain it (XAMPPRocky#684)
Browse files Browse the repository at this point in the history
* avoids adding it twice
* fixes issue with pagination not working due to base path added twice

Co-authored-by: Markus Wesemann <[email protected]>
  • Loading branch information
2 people authored and benpueschel committed Aug 30, 2024
1 parent 2f1c22c commit e7360ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/service/middleware/base_uri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ fn overwrite_base_uri(base_uri: &http::Uri, current_uri: Uri) -> http::Uri {
// Remove any trailing slashes and join.
// `PathAndQuery` always starts with a slash.
let base_path = pandq.path().trim_end_matches('/');
builder.path_and_query(format!("{base_path}{req_pandq}"))
if !req_pandq.as_str().starts_with(base_path) {
builder.path_and_query(format!("{base_path}{req_pandq}"))
} else {
builder.path_and_query(req_pandq.as_str())
}
} else {
builder.path_and_query(pandq.as_str())
};
Expand Down

0 comments on commit e7360ab

Please sign in to comment.