Skip to content

Commit 01972f6

Browse files
committed
Give precedence to local shared files over global ones
When serving 'essential files', we can either serve the global one, created when building `empty_library`, or the local one, created when building the local crate. Currently we default to the global one, but this causes issues when the file should never have been global in the first place (such as recently for `crates.js`: see #1313). This gives precedence to the local file so that the bug will be fixed when rustdoc fixes it, even if we forget to update `ESSENTIAL_FILES_UNVERSIONED`.
1 parent 4ee9d89 commit 01972f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/web/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ impl Handler for CratesfyiHandler {
174174
// try serving shared rustdoc resources first, then db/static file handler and last router
175175
// return 404 if none of them return Ok. It is important that the router comes last,
176176
// because it gives the most specific errors, e.g. CrateNotFound or VersionNotFound
177-
self.shared_resource_handler
177+
self.router_handler
178178
.handle(req)
179-
.or_else(|e| if_404(e, || self.router_handler.handle(req)))
179+
.or_else(|e| if_404(e, || self.shared_resource_handler.handle(req)))
180180
.or_else(|e| if_404(e, || self.database_file_handler.handle(req)))
181181
.or_else(|e| {
182182
let err = if let Some(err) = e.error.downcast_ref::<error::Nope>() {

0 commit comments

Comments
 (0)