From 4e90caaad144f84c8a9e59ddd3ba38a52135e1ad Mon Sep 17 00:00:00 2001
From: Michael Hamann <michael@content-space.de>
Date: Fri, 8 Mar 2013 18:15:02 +0100
Subject: [PATCH] Redirect only in the show action to namespace start pages
 FS#2743

When the current page id ends with ":" (or "/" with useslash enabled)
DokuWiki tries to find the start page of namespaces automatically and
then redirects to this page. The target of the redirect is always the
show action regardless if the current request contains another action or
is an ajax request. In practice you can get this problem when your
search query ends with ":" (e.g. because you want to match a namespace),
then you are redirected to the show action.

This change completely disables the redirect when $ACT is undefined or
the current action is not "show".
---
 inc/pageutils.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/inc/pageutils.php b/inc/pageutils.php
index ca4936a82..5043d2263 100644
--- a/inc/pageutils.php
+++ b/inc/pageutils.php
@@ -21,6 +21,7 @@
 function getID($param='id',$clean=true){
     global $INPUT;
     global $conf;
+    global $ACT;
 
     $id = $INPUT->str($param);
 
@@ -75,7 +76,7 @@ function getID($param='id',$clean=true){
             // fall back to default
             $id = $id.$conf['start'];
         }
-        send_redirect(wl($id,'',true));
+        if (isset($ACT) && $ACT === 'show') send_redirect(wl($id,'',true));
     }
 
     if($clean) $id = cleanID($id);
-- 
GitLab