CC-5892: Handle when a file is downloaded from the Airtime library
This commit is contained in:
parent
6f119b006f
commit
e7dfc08128
|
@ -81,6 +81,18 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$media = Application_Model_StoredFile::RecallById($fileId);
|
||||
if ($media != null) {
|
||||
|
||||
if ($media->isInCloud()) {
|
||||
if ("true" == $this->_getParam('download')) {
|
||||
header('Content-type:'.$media->getPropelOrm()->getDbMime());
|
||||
header('Content-Disposition: attachment; filename="'.$media->getResourceId().'"');
|
||||
header('Content-length:'.$media->getFileSize());
|
||||
echo $media->getCloudUrl();
|
||||
exit;
|
||||
} else {
|
||||
$this->_redirect($media->getCloudUrl());
|
||||
}
|
||||
}
|
||||
|
||||
$filepath = $media->getFilePath();
|
||||
// Make sure we don't have some wrong result beecause of caching
|
||||
|
|
|
@ -46,8 +46,8 @@ class AudiopreviewController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
if ($type == "audioclip") {
|
||||
$uri = $baseUrl."api/get-media/file/".$audioFileID;
|
||||
$media = Application_Model_StoredFile::RecallById($audioFileID);
|
||||
$uri = $baseUrl."api/get-media/file/".$audioFileID;
|
||||
$mime = $media->getPropelOrm()->getDbMime();
|
||||
} elseif ($type == "stream") {
|
||||
$webstream = CcWebstreamQuery::create()->findPk($audioFileID);
|
||||
|
|
Loading…
Reference in New Issue