don't crash if blog folder doesnt exist
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending

This commit is contained in:
Mylloon 2023-04-24 17:34:58 +02:00
parent 4984e3673e
commit fd228be916
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -52,11 +52,13 @@ struct Post {
}
fn get_posts(location: &str) -> Vec<Post> {
let entries = std::fs::read_dir(location)
.unwrap()
let entries = match std::fs::read_dir(location) {
Ok(res) => res
.flatten()
.filter(|f| f.path().extension().unwrap() == "md")
.collect::<Vec<std::fs::DirEntry>>();
.collect::<Vec<std::fs::DirEntry>>(),
Err(_) => vec![],
};
entries
.iter()