Handle error case that could cause invalid disk usage reading

This commit is contained in:
Albert Santoni 2014-05-22 19:16:42 -04:00
parent 091be8cea3
commit e1a0429939
1 changed files with 8 additions and 1 deletions

View File

@ -234,7 +234,14 @@ class Rest_MediaController extends Zend_Rest_Controller
//our internal schema. Internally, file path is stored relative to a directory, with the directory
//as a foreign key to cc_music_dirs.
if (isset($requestData["full_path"])) {
Application_Model_Preference::updateDiskUsage(filesize($requestData["full_path"]));
$fileSizeBytes = filesize($requestData["full_path"]);
if ($fileSizeBytes === false)
{
$file->setDbImportStatus(2)->save();
$this->fileNotFoundResponse();
return;
}
Application_Model_Preference::updateDiskUsage($fileSizeBytes);
$fullPath = $requestData["full_path"];
$storDir = Application_Model_MusicDir::getStorDir()->getDirectory();