SAAS-503: PYPO -> Use the REST API to download files

This commit is contained in:
drigato 2014-12-03 13:22:52 -05:00
parent e1f1807f5a
commit 16dc286420
3 changed files with 21 additions and 21 deletions

View file

@ -70,9 +70,10 @@ class Rest_MediaController extends Zend_Rest_Controller
$storedFile = new Application_Model_StoredFile($file, $con);
$baseUrl = Application_Common_OsPath::getBaseDir();
$CC_CONFIG = Config::getConfig();
$this->getResponse()
->setHttpResponseCode(200)
->appendBody($this->_redirect($storedFile->getRelativeFileUrl($baseUrl).'/download/true'));
->appendBody($this->_redirect($storedFile->getRelativeFileUrl($baseUrl).'/download/true/api_key/'.$CC_CONFIG["apiKey"][0]));
} else {
$this->fileNotFoundResponse();
}
@ -307,7 +308,6 @@ class Rest_MediaController extends Zend_Rest_Controller
$authHeader = $this->getRequest()->getHeader("Authorization");
$encodedRequestApiKey = substr($authHeader, strlen("Basic "));
$encodedStoredApiKey = base64_encode($CC_CONFIG["apiKey"][0] . ":");
if ($encodedRequestApiKey === $encodedStoredApiKey)
{
return true;