File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -280,13 +280,21 @@ pub fn rustdoc_html_server_handler(req: &mut Request) -> IronResult<Response> {
280
280
. to_resp ( "rustdoc" )
281
281
}
282
282
283
+ /// Checks whether the given path (including version and target information) exists.
284
+ /// The crate's `target_name` is used to confirm whether a platform triple is part of the path.
285
+ ///
286
+ /// Returns a path that can be appended to `/crate/version/` to create a complete URL.
283
287
fn path_for_version ( req_path : & [ & str ] , target_name : & str , conn : & Connection ) -> String {
284
288
if File :: from_path ( & conn, & req_path. join ( "/" ) ) . is_some ( ) {
285
- req_path[ 3 ..] . join ( "/" ) // NOTE: this adds 'index.html' if it wasn't there before
286
- } else { // this page doesn't exist in the latest version
287
- let search_item = if * req_path. last ( ) . unwrap ( ) == "index.html" { // this is a module
289
+ // NOTE: this adds 'index.html' if it wasn't there before
290
+ req_path[ 3 ..] . join ( "/" )
291
+ } else {
292
+ // this page doesn't exist in the latest version
293
+ let search_item = if * req_path. last ( ) . unwrap ( ) == "index.html" {
294
+ // this is a module
288
295
req_path[ req_path. len ( ) - 2 ]
289
- } else { // this is an item
296
+ } else {
297
+ // this is an item
290
298
req_path. last ( ) . unwrap ( ) . split ( '.' ) . nth ( 1 )
291
299
. expect ( "paths should be of the form <class>.<name>.html" )
292
300
} ;
You can’t perform that action at this time.
0 commit comments