Ensure file exists when receiving events for zola serve

Closes #2563
This commit is contained in:
Vincent Prouillet 2024-07-04 12:26:30 +02:00 committed by Vincent Prouillet
parent 96f266e3f8
commit 1cc3ad333a
2 changed files with 9 additions and 1 deletions

View file

@ -1046,7 +1046,9 @@ impl Site {
None => return Ok(()), None => return Ok(()),
}; };
for (feed, feed_filename) in feeds.into_iter().zip(self.config.languages[lang].feed_filenames.iter()) { for (feed, feed_filename) in
feeds.into_iter().zip(self.config.languages[lang].feed_filenames.iter())
{
if let Some(base) = base_path { if let Some(base) = base_path {
let mut components = Vec::new(); let mut components = Vec::new();
for component in base.components() { for component in base.components() {

View file

@ -82,6 +82,12 @@ pub fn filter_events(
} }
let path = event.event.paths[0].clone(); let path = event.event.paths[0].clone();
// Since we debounce things, some files might already not exist anymore by the
// time we get to them
if !path.exists() {
continue;
}
if is_ignored_file(ignored_content_globset, &path) { if is_ignored_file(ignored_content_globset, &path) {
continue; continue;
} }