From 0271337f8e3bf13462016383f45b3f3098be2056 Mon Sep 17 00:00:00 2001 From: masecla22 Date: Tue, 14 Mar 2023 23:06:33 +0100 Subject: [PATCH] Fixed an issue with colliding slugs when modifying a project (#562) * Fixed an issue with colliding slugs when modifying a project * Update projects.rs --------- Co-authored-by: triphora --- src/routes/projects.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routes/projects.rs b/src/routes/projects.rs index 93160c729..df3238ac5 100644 --- a/src/routes/projects.rs +++ b/src/routes/projects.rs @@ -884,9 +884,11 @@ pub async fn project_edit( } } - { + // Make sure the new slug is different from the old one + // We are able to unwrap here because the slug is always set + if !slug.eq(&project_item.inner.slug.unwrap_or_default()) { let results = sqlx::query!( - " + " SELECT EXISTS(SELECT 1 FROM mods WHERE slug = LOWER($1)) ", slug