From 9bc1c66fe3b1af263fcac152de85c2dd6876e0f3 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 5 Jul 2012 15:27:49 -0400 Subject: [PATCH] CC-2747: If the file contains '\' in its meta title, airtime doesn't detect duplicate - fixed - extra fix: there was also problem with web UI upload and it's fixed see the comment on the ticket for more detail. --- .../application/controllers/ApiController.php | 13 +++++++------ .../application/controllers/PluploadController.php | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 8d9d1d8f4..a46367c9d 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -573,8 +573,9 @@ class ApiController extends Zend_Controller_Action Application_Model_Preference::SetImportTimestamp(); if ($mode == "create") { $filepath = $md['MDATA_KEY_FILEPATH']; - $filepath = str_replace("\\", "", $filepath); - $filepath = str_replace("//", "/", $filepath); + //$filepath = str_replace("\\", "", $filepath); + //$filepath = str_replace("//", "/", $filepath); + $filepath = Application_Common_OsPath::normpath($filepath); $file = Application_Model_StoredFile::RecallByFilepath($filepath); if (is_null($file)) { @@ -595,7 +596,7 @@ class ApiController extends Zend_Controller_Action } else if ($mode == "modify") { $filepath = $md['MDATA_KEY_FILEPATH']; - $filepath = str_replace("\\", "", $filepath); + //$filepath = str_replace("\\", "", $filepath); $file = Application_Model_StoredFile::RecallByFilepath($filepath); //File is not in database anymore. @@ -618,13 +619,13 @@ class ApiController extends Zend_Controller_Action } else { $filepath = $md['MDATA_KEY_FILEPATH']; - $filepath = str_replace("\\", "", $filepath); + //$filepath = str_replace("\\", "", $filepath); $file->setFilePath($filepath); } } else if ($mode == "delete") { $filepath = $md['MDATA_KEY_FILEPATH']; - $filepath = str_replace("\\", "", $filepath); + //$filepath = str_replace("\\", "", $filepath); $file = Application_Model_StoredFile::RecallByFilepath($filepath); if (is_null($file)) { @@ -637,7 +638,7 @@ class ApiController extends Zend_Controller_Action } else if ($mode == "delete_dir") { $filepath = $md['MDATA_KEY_FILEPATH']; - $filepath = str_replace("\\", "", $filepath); + //$filepath = str_replace("\\", "", $filepath); $files = Application_Model_StoredFile::RecallByPartialFilepath($filepath); foreach($files as $file){ diff --git a/airtime_mvc/application/controllers/PluploadController.php b/airtime_mvc/application/controllers/PluploadController.php index 909351d3c..6e34f10a6 100644 --- a/airtime_mvc/application/controllers/PluploadController.php +++ b/airtime_mvc/application/controllers/PluploadController.php @@ -40,7 +40,7 @@ class PluploadController extends Zend_Controller_Action $tempname = $this->_getParam('tempname'); $result = Application_Model_StoredFile::copyFileToStor($upload_dir, $filename, $tempname); if (!is_null($result)) - die('{"jsonrpc" : "2.0", "error" : {"code": '.$result['code'].', "message" : "'.$result['message'].'"}}'); + die('{"jsonrpc" : "2.0", "error" : '.json_encode($result).'}'); die('{"jsonrpc" : "2.0"}'); }