Skip to content

Commit 3332833

Browse files
committed
automatically add missing index.html from path.
1 parent 80918c2 commit 3332833

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/bin/server.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,19 @@ impl Thing {
278278
));
279279
}
280280
}
281+
Err(e) if e.kind() == ErrorKind::IsADirectory => {
282+
return self.resp_redirect(&format!(
283+
"/{}/{}/{}/{}index.html",
284+
krate,
285+
version,
286+
flavor,
287+
path[3..].iter().fold(String::new(), |mut s, p| {
288+
s.push_str(p);
289+
s.push('/');
290+
s
291+
})
292+
))
293+
}
281294
x => x?,
282295
}
283296
.into_owned();

0 commit comments

Comments
 (0)