Skip to content

Commit 720e94e

Browse files
Directly use params.path instead of using original URI
1 parent c9ed8c6 commit 720e94e

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/web/crate_details.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -505,19 +505,12 @@ pub(crate) async fn get_all_platforms(
505505
Extension(pool): Extension<Pool>,
506506
uri: Uri,
507507
) -> AxumResult<AxumResponse> {
508-
// since we directly use the Uri-path and not the extracted params from the router,
509-
// we have to percent-decode the string here.
510-
let original_path = percent_encoding::percent_decode(uri.path().as_bytes())
511-
.decode_utf8()
512-
.map_err(|_| AxumNope::BadRequest)?;
513-
let mut req_path: Vec<&str> = original_path.split('/').collect();
508+
let req_path: String = params.path.unwrap_or_default();
509+
let req_path: Vec<&str> = req_path.split('/').collect();
514510

515511
let release_found = match_version_axum(&pool, &params.name, Some(&params.version)).await?;
516512
trace!(?release_found, "found release");
517513

518-
// Remove the empty start, "releases", the name and the version from the path
519-
req_path.drain(..4).for_each(drop);
520-
521514
// Convenience function to allow for easy redirection
522515
#[instrument]
523516
fn redirect(

0 commit comments

Comments
 (0)