From 17ff9c04665a46320fd67285fb3dcf26eb5f3e0e Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Sun, 1 Mar 2009 20:24:34 +0100
Subject: [PATCH] fixed depth checking in search_(media|allpages)

darcs-hash:20090301192434-7ad00-aa49d6b371e3832e4c45c89ac8ffd367d278c74c.gz
---
 inc/search.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/inc/search.php b/inc/search.php
index dd5bda9be..2462cb240 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -188,7 +188,7 @@ function search_media(&$data,$base,$file,$type,$lvl,$opts){
     //we do nothing with directories
     if($type == 'd') {
         if(!$opts['depth']) return true; // recurse forever
-        $parts = explode('/',$file);
+        $parts = explode('/',ltrim($file,'/'));
         if(count($parts) == $opts['depth']) return false; // depth reached
         return true;
         return ($opts['recursive']);
@@ -293,7 +293,7 @@ function search_allpages(&$data,$base,$file,$type,$lvl,$opts){
     //we do nothing with directories
     if($type == 'd'){
         if(!$opts['depth']) return true; // recurse forever
-        $parts = explode('/',$file);
+        $parts = explode('/',ltrim($file,'/'));
         if(count($parts) == $opts['depth']) return false; // depth reached
         return true;
     }
-- 
GitLab