[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX]: Tiki wiki page rename: if page name is not changed, there is a false...

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6942d2c477c40_2a17ffac97012@gitlab-sidekiq-low-urgency-cpu-bound-v2-747b965b95-qhsjw.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
4e97f735 by Grace Nshokano at 2025-12-17T15:46:31+00:00
[FIX]: Tiki wiki page rename: if page name is not changed, there is a false...
---
* [FIX] tiki wiki page rename: if page name is not changed, there is a false report: success: page renamed

See merge request tikiwiki/tiki!9183

- - - - -


2 changed files:

- lib/wiki/wikilib.php
- tiki-rename_page.php


Changes:

=====================================
lib/wiki/wikilib.php
=====================================
@@ -244,6 +244,12 @@ class WikiLib extends TikiLib
         $tikilib = TikiLib::lib('tiki');
         // if page already exists, stop here
         $newName = trim($newName);
+        $oldName = trim($oldName);
+
+        // Check if trying to rename to the same name
+        if ($oldName === $newName) {
+            throw new Exception("Cannot rename page to the same name", 3);
+        }
         if ($this->get_page_info($newName, false, true)) {
             // if it is a case change of same page: allow it, else stop here
             if (strcasecmp(trim($oldName), $newName) <> 0) {


=====================================
tiki-rename_page.php
=====================================
@@ -83,6 +83,9 @@ if ((isset($_REQUEST["rename"]) || isset($_REQUEST["confirm"])) && $access->chec
                 case 2:
                     Feedback::error(tr('Page already exists'));
                     break;
+                case 3:
+                    Feedback::error(tr('Cannot rename page to the same name'));
+                    break;
                 default:
                     throw $e;
             }



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

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