File tree 1 file changed +8
-31
lines changed
1 file changed +8
-31
lines changed Original file line number Diff line number Diff line change @@ -485,37 +485,14 @@ pub fn search_handler(req: &mut Request) -> IronResult<Response> {
485
485
486
486
487
487
if let Some ( version) = match_version ( & conn, & query, None ) {
488
- // FIXME: This is a super dirty way to check if crate have rustdocs generated.
489
- // match_version should handle this instead of this code block.
490
- // This block is introduced to fix #163
491
- let rustdoc_status = {
492
- let rows = ctry ! ( conn. query( "SELECT rustdoc_status
493
- FROM releases
494
- INNER JOIN crates
495
- ON crates.id = releases.crate_id
496
- WHERE crates.name = $1 AND releases.version = $2" ,
497
- & [ query, & version] ) ) ;
498
- if rows. is_empty ( ) {
499
- false
500
- } else {
501
- rows. get ( 0 ) . get ( 0 )
502
- }
503
- } ;
504
- let url = if rustdoc_status {
505
- ctry ! ( Url :: parse( & format!( "{}://{}:{}/{}/{}" ,
506
- req. url. scheme( ) ,
507
- req. url. host( ) ,
508
- req. url. port( ) ,
509
- query,
510
- version) [ ..] ) )
511
- } else {
512
- ctry ! ( Url :: parse( & format!( "{}://{}:{}/crate/{}/{}" ,
513
- req. url. scheme( ) ,
514
- req. url. host( ) ,
515
- req. url. port( ) ,
516
- query,
517
- version) [ ..] ) )
518
- } ;
488
+ // If the crate doesn't have docs, the `crate/version` route will redirect to the
489
+ // crate details page instead
490
+ let url = ctry ! ( Url :: parse( & format!( "{}://{}:{}/{}/{}" ,
491
+ req. url. scheme( ) ,
492
+ req. url. host( ) ,
493
+ req. url. port( ) ,
494
+ query,
495
+ version) [ ..] ) ) ;
519
496
let mut resp = Response :: with ( ( status:: Found , Redirect ( url) ) ) ;
520
497
521
498
use iron:: headers:: { Expires , HttpDate } ;
You can’t perform that action at this time.
0 commit comments