Skip to content

Commit

Permalink
automatically add missing index.html from path.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirbaio committed Dec 8, 2023
1 parent 80918c2 commit 3332833
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,19 @@ impl Thing {
));
}
}
Err(e) if e.kind() == ErrorKind::IsADirectory => {
return self.resp_redirect(&format!(
"/{}/{}/{}/{}index.html",
krate,
version,
flavor,
path[3..].iter().fold(String::new(), |mut s, p| {
s.push_str(p);
s.push('/');
s
})
))
}
x => x?,
}
.into_owned();
Expand Down

0 comments on commit 3332833

Please sign in to comment.