resolve crash when there a directory
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
This commit is contained in:
parent
49392f5ca5
commit
36d4889983
1 changed files with 4 additions and 1 deletions
|
@ -99,7 +99,10 @@ fn get_posts(location: &str) -> Vec<Post> {
|
||||||
let entries = match std::fs::read_dir(location) {
|
let entries = match std::fs::read_dir(location) {
|
||||||
Ok(res) => res
|
Ok(res) => res
|
||||||
.flatten()
|
.flatten()
|
||||||
.filter(|f| f.path().extension().unwrap() == "md")
|
.filter(|f| match f.path().extension() {
|
||||||
|
Some(ext) => ext == "md",
|
||||||
|
None => false,
|
||||||
|
})
|
||||||
.collect::<Vec<std::fs::DirEntry>>(),
|
.collect::<Vec<std::fs::DirEntry>>(),
|
||||||
Err(_) => vec![],
|
Err(_) => vec![],
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue