Skip to content

Commit ffa3dca

Browse files
committed
Give precedence to global shared files over local ones
This avoids broken docs for crates build with an old version of rustdoc that didn't respect the shared static root.
1 parent ec169c0 commit ffa3dca

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/web/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ impl Handler for CratesfyiHandler {
157157
handle: impl FnOnce() -> IronResult<Response>,
158158
) -> IronResult<Response> {
159159
if e.response.status == Some(status::NotFound) {
160-
// the routes are ordered from most specific to least; give precedence to the
161-
// original error message.
162-
handle().or(Err(e))
160+
// the routes are ordered from least specific to most; give precedence to the
161+
// new error message.
162+
handle()
163163
} else {
164164
Err(e)
165165
}
@@ -176,11 +176,11 @@ impl Handler for CratesfyiHandler {
176176
// specific path means that buggy docs from 2018 will have missing CSS (#1181) so until
177177
// that's fixed, we need to keep the current (buggy) behavior.
178178
//
179-
// It's important that `router_handler` comes first so that local rustdoc files take
180-
// precedence over global ones (see #1324).
181-
self.router_handler
179+
// It's important that `shared_resource_handler` comes first so that global rustdoc files take
180+
// precedence over local ones (see #1327).
181+
self.shared_resource_handler
182182
.handle(req)
183-
.or_else(|e| if_404(e, || self.shared_resource_handler.handle(req)))
183+
.or_else(|e| if_404(e, || self.router_handler.handle(req)))
184184
.or_else(|e| {
185185
let err = if let Some(err) = e.error.downcast_ref::<error::Nope>() {
186186
*err

0 commit comments

Comments
 (0)