[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Duplicate entry on slug regeneration

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68b8412847d70_2c1742ca45622@gitlab-sidekiq-low-urgency-cpu-bound-v2-799dc879cb-wtcdg.mail>

Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
7bea987d by ushindi bienvenu at 2025-09-03T13:14:40+00:00
[FIX] Duplicate entry on slug regeneration
---
* [FIX] Duplicate entry on slug regeneration

See merge request tikiwiki/tiki!8414

- - - - -


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/7bea987d5e6494af3bb4861e0c70c03c785ab467

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/7bea987d5e6494af3bb4861e0c70c03c785ab467
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.