[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][FIX] Duplicate entry on slug regeneration

"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68c2a665a6fbe_2c478600064da@gitlab-sidekiq-low-urgency-cpu-bound-v2-c6f5977fd-4vznz.mail>

ushindi bienvenu pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
c55ae254 by ushindi bienvenu at 2025-09-11T10:30:44+00:00
[BP][FIX] Duplicate entry on slug regeneration
---
* [FIX] Duplicate entry on slug regeneration
---
* [FIX] Duplicate entry on slug regeneration

See merge request tikiwiki/tiki!8414

See merge request tikiwiki/tiki!8560

- - - - -


1 changed file:

- tiki-editpage.php


Changes:

=====================================
tiki-editpage.php
=====================================
@@ -160,6 +160,18 @@ if (strtolower($_REQUEST["page"]) == 'sandbox' && $prefs['feature_sandbox'] !==
 }
 
 $page = $_REQUEST["page"];
+if (isset($_GET['quickedit'])) {
+    // Normalize before checking input by replacing prefs[wiki_url_scheme] symbols ("-", "_", and "+") with space.
+    // This ensures page names like "Marc Andre" and "Marc-Andre" are treated as the same,
+    // preventing slug duplication when regenerating.
+    $normalized = preg_replace('/[\s+_-]/', ' ', $page);
+    if ($page_by_slug = $tikilib->getPageBySlug($normalized)) {
+        Feedback::errorAndDie(
+            tr('Cannot create page "%0", A page "%1" with the same slug variation already exists.', $page, '<strong>' . $page_by_slug . '</strong>'),
+            \Laminas\Http\Response::STATUS_CODE_409
+        );
+    }
+}
 
 if (isset($_REQUEST["description"])) {
     $max_pagedescription_length = 201;



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c55ae254a238d3c297904d096f70efc041422296

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c55ae254a238d3c297904d096f70efc041422296
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.