File tree Expand file tree Collapse file tree 2 files changed +6
-16
lines changed Expand file tree Collapse file tree 2 files changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -68,16 +68,7 @@ pub struct DatabaseFileHandler;
68
68
69
69
impl Handler for DatabaseFileHandler {
70
70
fn handle ( & self , req : & mut Request ) -> IronResult < Response > {
71
-
72
- let mut path = req. url . path ( ) . join ( "/" ) ;
73
-
74
- // rustdoc javascript files are kept under rustdoc prefix
75
- // i.e: search-index.js, sidebar-items.js, trait.X.js etc.
76
- // FIXME: This is extremely poor implementation
77
- if path. ends_with ( ".js" ) && !path. starts_with ( "main" ) && !path. starts_with ( "jquery" ) {
78
- path = format ! ( "rustdoc/{}" , path) ;
79
- }
80
-
71
+ let path = req. url . path ( ) . join ( "/" ) ;
81
72
let conn = extension ! ( req, Pool ) ;
82
73
if let Some ( file) = File :: from_path ( & conn, & path) {
83
74
Ok ( file. serve ( ) )
Original file line number Diff line number Diff line change @@ -139,17 +139,16 @@ pub fn rustdoc_html_server_handler(req: &mut Request) -> IronResult<Response> {
139
139
path
140
140
} ;
141
141
142
- // don't touch anything other than html files
143
- if !path. ends_with ( ".html" ) {
144
- return Err ( IronError :: new ( Nope :: ResourceNotFound , status:: NotFound ) ) ;
145
- }
146
-
147
-
148
142
let file = match File :: from_path ( & conn, & path) {
149
143
Some ( f) => f,
150
144
None => return Err ( IronError :: new ( Nope :: ResourceNotFound , status:: NotFound ) ) ,
151
145
} ;
152
146
147
+ // serve file directly if it's not html
148
+ if !path. ends_with ( ".html" ) {
149
+ return Ok ( file. serve ( ) ) ;
150
+ }
151
+
153
152
let ( mut in_head, mut in_body) = ( false , false ) ;
154
153
155
154
let mut content = RustdocPage :: default ( ) ;
You can’t perform that action at this time.
0 commit comments