message: Add tests for platforms other than the default
diff: @@ -430,12 +430,13 @@ fn path_for_version(
  return req_path[3..].join("/");
  }
  // this page doesn't exist in the latest version
  - let search_item = if *req_path.last().unwrap() == "index.html" {
  + let last_component = *req_path.last().unwrap();
  + let search_item = if last_component == "index.html" {
  // this is a module
  req_path.get(req_path.len() - 2).copied()
  } else {
  // this is an item
  - req_path.last().unwrap().split('.').nth(1)
  + last_component.split('.').nth(1)
  };
  // check if req_path[3] is the platform choice or the name of the crate
  let platform = if known_platforms.iter().any(|s| s == req_path[3]) && req_path.len() >= 5 {
  @@ -1420,11 +1421,31 @@ mod test {
  crate::test::wrapper(|env| {
  let db = env.db();
  db.fake_release().name("dummy").version("0.1.0").create()?;
  + let web = env.frontend();
  assert_redirect(
  "/crate/dummy/0.1.0/target-redirect/x86_64-apple-darwin",
  "/dummy/0.1.0/dummy/",
  - env.frontend(),
  - )
  + web,
  + )?;
  + db.fake_release()
  + .name("dummy")
  + .version("0.2.0")
  + .add_platform("x86_64-apple-darwin")
  + .create()?;
  + assert_redirect(
  + "/crate/dummy/0.2.0/target-redirect/x86_64-apple-darwin",
  + // NOTE: this does _not_ redirect to the platform in case it gives a 404.
  + // Any time we serve /target-redirect without a trailing slash,
  + // someone typed in the URL manually, so we want to avoid 404s.
  + "/dummy/0.2.0/dummy/",
  + web,
  + )?;
  + assert_redirect(
  + "/crate/dummy/0.2.0/target-redirect/platform-that-does-not-exist",
  + "/dummy/0.2.0/dummy/",
  + web,
  + )?;
  + Ok(())
  })
  }
  