Skip to content

Commit d519f26

Browse files
committed
Add a check to make sure that we don't render the same file twice
1 parent 8f0a36e commit d519f26

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/render.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ impl<'a, T: Serialize> PageCtx<'a, T> {
5050

5151
let out_path = self.output_dir.join(path);
5252
ensure_directory(&out_path)?;
53+
54+
if out_path.is_file() {
55+
return Err(anyhow::anyhow!(
56+
"Trying to render file {}, which already exists",
57+
out_path.display()
58+
));
59+
}
60+
5361
let mut output_file = BufWriter::new(
5462
File::create(&out_path)
5563
.with_context(|| anyhow::anyhow!("Cannot create file at {}", path.display()))?,

0 commit comments

Comments
 (0)