Skip to content

Commit 6621b3e

Browse files
committed
Add check for aliased redirects
1 parent 66b6ba3 commit 6621b3e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/render.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,12 @@ pub fn render_directory(render_ctx: &RenderCtx, category: &str) -> anyhow::Resul
261261
}
262262

263263
pub fn render_redirect(render_ctx: &RenderCtx, from: &str, to: &str) -> anyhow::Result<()> {
264+
if from == format!("{to}.html") || format!("{from}.html") == to {
265+
return Err(anyhow::anyhow!(
266+
"Trying to setup redirect from {from} to {to}, which would alias"
267+
));
268+
}
269+
264270
#[derive(Serialize)]
265271
struct Data {
266272
url: String,

0 commit comments

Comments
 (0)