From 95efc2f3a7143bc6d6d8108e6e923924afef6966 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Thu, 4 Apr 2013 16:10:17 +0200 Subject: [PATCH] trim path before checking, fixes #927 Signed-off-by: Michael Kaufmann (d00p) --- lib/functions/filedir/function.makeCorrectDir.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/functions/filedir/function.makeCorrectDir.php b/lib/functions/filedir/function.makeCorrectDir.php index 2965bacb..440346b2 100644 --- a/lib/functions/filedir/function.makeCorrectDir.php +++ b/lib/functions/filedir/function.makeCorrectDir.php @@ -25,18 +25,16 @@ * @author Florian Lippert */ -function makeCorrectDir($dir) -{ - if(substr($dir, -1, 1) != '/') - { +function makeCorrectDir($dir) { + + $dir = trim($dir); + + if (substr($dir, -1, 1) != '/') { $dir.= '/'; } - - if(substr($dir, 0, 1) != '/') - { + if (substr($dir, 0, 1) != '/') { $dir = '/' . $dir; } - $dir = makeSecurePath($dir); return $dir; }