diff --git a/src/web/crate_details.rs b/src/web/crate_details.rs index be079ff41..747b53c9a 100644 --- a/src/web/crate_details.rs +++ b/src/web/crate_details.rs @@ -116,7 +116,7 @@ impl CrateDetails { ) -> Result { Ok(Self::new( conn, - &release.name, + &release.corrected_name.unwrap_or(release.name), &release.release.version, Some(release.req_version), release.all_releases, diff --git a/src/web/rustdoc.rs b/src/web/rustdoc.rs index d834a785c..a66812e27 100644 --- a/src/web/rustdoc.rs +++ b/src/web/rustdoc.rs @@ -1859,6 +1859,25 @@ mod test { }); } + #[test] + fn test_target_redirect_with_corrected_name() { + wrapper(|env| { + env.fake_release() + .name("foo_ab") + .version("0.0.1") + .archive_storage(true) + .create()?; + + let web = env.frontend(); + assert_redirect_unchecked( + "/crate/foo-ab/0.0.1/target-redirect/x86_64-unknown-linux-gnu", + "/foo-ab/0.0.1/foo_ab/", + web, + )?; + Ok(()) + }) + } + #[test] fn test_target_redirect_not_found() { wrapper(|env| {