Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 127f936

Browse files
committedAug 8, 2023
Directly use params.path instead of using original URI
1 parent 43cd580 commit 127f936

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
@@ -496,19 +496,12 @@ pub(crate) async fn get_all_platforms(
496496
Extension(pool): Extension<Pool>,
497497
uri: Uri,
498498
) -> AxumResult<AxumResponse> {
499-
// since we directly use the Uri-path and not the extracted params from the router,
500-
// we have to percent-decode the string here.
501-
let original_path = percent_encoding::percent_decode(uri.path().as_bytes())
502-
.decode_utf8()
503-
.map_err(|_| AxumNope::BadRequest)?;
504-
let mut req_path: Vec<&str> = original_path.split('/').collect();
499+
let req_path: String = params.path.unwrap_or_default();
500+
let req_path: Vec<&str> = req_path.split('/').collect();
505501

506502
let release_found = match_version_axum(&pool, &params.name, Some(&params.version)).await?;
507503
trace!(?release_found, "found release");
508504

509-
// Remove the empty start, "releases", the name and the version from the path
510-
req_path.drain(..4).for_each(drop);
511-
512505
// Convenience function to allow for easy redirection
513506
#[instrument]
514507
fn redirect(

0 commit comments

Comments
 (0)
Please sign in to comment.