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.
This commit is contained in:
James 2012-07-05 15:27:49 -04:00
parent 1cbb0345b3
commit 9bc1c66fe3
2 changed files with 8 additions and 7 deletions

View File

@ -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){

View File

@ -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"}');
}