@@ -226,6 +226,7 @@ pub fn rustdoc_html_server_handler(req: &mut Request) -> IronResult<Response> {
226226 req_path. insert ( 2 , & version) ;
227227
228228 // if visiting the full path to the default target, remove the target from the path
229+ // expects a req_path that looks like `/rustdoc/:crate/:version[/:target]/.*`
229230 let crate_details = cexpect ! ( CrateDetails :: new( & conn, & name, & version) ) ;
230231 if req_path[ 3 ] == crate_details. metadata . default_target {
231232 let path = [ base, req_path[ 1 ..3 ] . join ( "/" ) , req_path[ 4 ..] . join ( "/" ) ] . join ( "/" ) ;
@@ -243,16 +244,6 @@ pub fn rustdoc_html_server_handler(req: &mut Request) -> IronResult<Response> {
243244 path
244245 } ;
245246
246- // if visiting the full path to the default target, remove the target from the path
247- // expects a req_path that looks like `/rustdoc/:crate/:version[/:target]/.*`
248- let crate_details = cexpect ! ( CrateDetails :: new( & conn, & name, & version) ) ;
249- debug ! ( "req_path: {}, default_target: {}" , req_path. join( "/" ) , crate_details. metadata. default_target) ;
250- if req_path[ 3 ] == crate_details. metadata . default_target {
251- let path = [ base, req_path[ 1 ..3 ] . join ( "/" ) , req_path[ 4 ..] . join ( "/" ) ] . join ( "/" ) ;
252- let canonical = Url :: parse ( & path) . expect ( "got an invalid URL to start" ) ;
253- return Ok ( super :: redirect ( canonical) ) ;
254- }
255-
256247 let file = match File :: from_path ( & conn, & path) {
257248 Some ( f) => f,
258249 None => return Err ( IronError :: new ( Nope :: ResourceNotFound , status:: NotFound ) ) ,
0 commit comments