Docs.rs: _/- redirection does not work for rustdoc paths

Created on 26 Apr 2020  路  9Comments  路  Source: rust-lang/docs.rs

Thanks #712 fixes the crate name unequal on -/_ bug. https://docs.rs/async_std can redirect to https://docs.rs/async-std/1.5.0/async_std/ . However, some path still get 404 The requested resource does not exist, for example, this URL: https://docs.rs/async_std/1.5.0/async_std/task/fn.spawn.html

Rust Search Extension shipped a new feature in recently to search the external crate's doc, this would be annoying if this bug wouldn't fix.

rust-search-extension

All 9 comments

This seems to me like a bug in Rust Search Extension. We intentionally did not redirect for exact paths under the rationale that if you had an exact path, you already knew the exact name of the crate. I think it would be better to fix Rust Search Extension to instead use the proper url.

I don't think this is a bug of the extension. I mean https://docs.rs/async_std/1.5.0/async_std/task/fn.spawn.html should also be redirected to https://docs.rs/async-std/1.5.0/async_std/task/fn.spawn.html .

I understand what you're asking, I'm saying this would be difficult on our end and I don't see the benefit since the only people using that path seem to be your search extension.

I'm willing to take a PR adding this but otherwise I don't plan on working on it. The PR should

  • include tests using crate::test::wrapper
  • redirect to the normalized url only if the original file was not found

You can find the normalized url using the index in the database, see https://github.com/rust-lang/docs.rs/blob/master/src/web/mod.rs#L265 for an example.

Thanks, @jyn514 . I think I can do this. 馃樃

This is fixed by #736

Deployed, https://docs.rs/async_std/1.5.0/async_std/task/fn.spawn.html no longer gives a 404 :)

Deployed, https://docs.rs/async_std/1.5.0/async_std/task/fn.spawn.html no longer gives a 404 :)

Wow, I can't believe this is so efficient to ship production! 馃帀馃コ

Was this page helpful?
0 / 5 - 0 ratings