@@ -226,6 +226,7 @@ pub fn rustdoc_html_server_handler(req: &mut Request) -> IronResult<Response> {
226
226
req_path. insert ( 2 , & version) ;
227
227
228
228
// 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]/.*`
229
230
let crate_details = cexpect ! ( CrateDetails :: new( & conn, & name, & version) ) ;
230
231
if req_path[ 3 ] == crate_details. metadata . default_target {
231
232
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> {
243
244
path
244
245
} ;
245
246
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
-
256
247
let file = match File :: from_path ( & conn, & path) {
257
248
Some ( f) => f,
258
249
None => return Err ( IronError :: new ( Nope :: ResourceNotFound , status:: NotFound ) ) ,
0 commit comments