diff options
-rw-r--r-- | inc/media.php | 2 | ||||
-rw-r--r-- | inc/pageutils.php | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/inc/media.php b/inc/media.php index 8a18e8b2e..ac0629b3f 100644 --- a/inc/media.php +++ b/inc/media.php @@ -245,7 +245,7 @@ function media_upload($ns,$auth){ } // get filename - $id = cleanID($ns.':'.$id); + $id = cleanID($ns.':'.$id,false,true); $fn = mediaFN($id); // get filetype regexp diff --git a/inc/pageutils.php b/inc/pageutils.php index 50e76d44e..abfca08de 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -86,8 +86,9 @@ function getID($param='id',$clean=true){ * @author Andreas Gohr <andi@splitbrain.org> * @param string $raw_id The pageid to clean * @param boolean $ascii Force ASCII + * @param boolean $media Allow leading or trailing _ for media files */ -function cleanID($raw_id,$ascii=false){ +function cleanID($raw_id,$ascii=false,$media=false){ global $conf; global $lang; static $sepcharpat = null; @@ -126,7 +127,7 @@ function cleanID($raw_id,$ascii=false){ //clean up $id = preg_replace($sepcharpat,$sepchar,$id); $id = preg_replace('#:+#',':',$id); - $id = trim($id,':._-'); + $id = ($media ? trim($id,':.-') : trim($id,':._-')); $id = preg_replace('#:[:\._\-]+#',':',$id); $cache[(string)$raw_id] = $id; |