From beb6fdb72185fdc7dafee97426364c59178885e7 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 2 Jun 2013 14:39:17 +0200 Subject: c/file/do_upload: fix fallback if base64_decode fails trim() would give us an empty string if base64_decode() returns false. Signed-off-by: Florian Pritz --- application/controllers/file.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'application/controllers/file.php') diff --git a/application/controllers/file.php b/application/controllers/file.php index b26ebcf37..cb95edf0c 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -602,7 +602,7 @@ class File extends CI_Controller { // TODO: this interface currently sets the same filename for every file if you use multiupload $filename = $this->input->post("filename"); if ($filename !== false) { - $filename = trim(base64_decode($filename, true), "\r\n\0\t\x0B"); + $filename = base64_decode($filename, true); } // fall back if base64_decode failed @@ -610,6 +610,8 @@ class File extends CI_Controller { $filename = $file['name']; } + $filename = trim($filename, "\r\n\0\t\x0B"); + $folder = $this->mfile->folder($hash); file_exists($folder) || mkdir ($folder); $file_path = $this->mfile->file($hash); -- cgit v1.2.3-24-g4f1b