From 156a608c0ca9fae2f48bf7322133edefaf93633f Mon Sep 17 00:00:00 2001
From: andi <andi@splitbrain.org>
Date: Mon, 30 May 2005 20:10:55 +0200
Subject: [PATCH] keep txt extension on uploaded txt files #360

darcs-hash:20050530181055-9977f-9a771ac829c8fe48557f6932cc99fd4318579a9e.gz
---
 inc/search.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/inc/search.php b/inc/search.php
index df3c74fcd..853faef8a 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -163,7 +163,7 @@ function search_media(&$data,$base,$file,$type,$lvl,$opts){
   if($type == 'd') return false;
 
   $info         = array();
-  $info['id']   = pathID($file);
+  $info['id']   = pathID($file,true);
 
   //check ACL for namespace (we have no ACL for mediafiles)
   if(auth_quickaclcheck(getNS($info['id']).':*') < AUTH_READ){
@@ -353,10 +353,10 @@ function sort_search_fulltext($a,$b){
  * @author  Andreas Gohr <andi@splitbrain.org>
  * @todo    move to pageutils
  */
-function pathID($path){
+function pathID($path,$keeptxt=false){
   $id = utf8_decodeFN($path);
   $id = str_replace('/',':',$id);
-  $id = preg_replace('#\.txt$#','',$id);
+  if(!$keeptxt) $id = preg_replace('#\.txt$#','',$id);
   $id = preg_replace('#^:+#','',$id);
   $id = preg_replace('#:+$#','',$id);
   return $id;
-- 
GitLab