Skip to content

Commit b09bcf0

Browse files
Nemo157Joshua Nelson
authored andcommitted
Allow redirecting to paths outside the crate root
1 parent 6aecfa0 commit b09bcf0

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/web/rustdoc.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,6 @@ pub fn target_redirect_handler(req: &mut Request) -> IronResult<Response> {
381381
file_path.remove(3);
382382
if file_path[3] == crate_details.metadata.default_target {
383383
file_path.remove(3);
384-
} else if file_path[4] != crate_details.target_name {
385-
// For non-default targets we only redirect to paths within the current crate
386-
file_path.drain(4..);
387-
file_path.push(&crate_details.target_name);
388-
file_path.push("index.html");
389384
}
390385
if let Some(last) = file_path.last_mut() {
391386
if *last == "" {
@@ -1032,6 +1027,7 @@ mod test {
10321027
.rustdoc_file("dummy/index.html", b"some content")
10331028
.rustdoc_file("dummy/struct.Dummy.html", b"some other content")
10341029
.rustdoc_file("dummy/struct.DefaultOnly.html", b"some otter content")
1030+
.rustdoc_file("x86_64-pc-windows-msvc/settings.html", b"top-level items")
10351031
.rustdoc_file("x86_64-pc-windows-msvc/dummy/index.html", b"some content")
10361032
.rustdoc_file(
10371033
"x86_64-pc-windows-msvc/dummy/struct.Dummy.html",
@@ -1053,7 +1049,7 @@ mod test {
10531049
&[
10541050
(
10551051
"x86_64-pc-windows-msvc",
1056-
"/dummy/0.4.0/x86_64-pc-windows-msvc/dummy/index.html",
1052+
"/dummy/0.4.0/x86_64-pc-windows-msvc/settings.html",
10571053
),
10581054
("x86_64-unknown-linux-gnu", "/dummy/0.4.0/settings.html"),
10591055
],

0 commit comments

Comments
 (0)