CC-2403: Downloading a file via the web UI returns an absolute path, not relative
-fixed to take into account the base URL.
This commit is contained in:
parent
a5d2597875
commit
7607bce6c8
|
@ -55,6 +55,8 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
$id = $this->_getParam('id');
|
$id = $this->_getParam('id');
|
||||||
$type = $this->_getParam('type');
|
$type = $this->_getParam('type');
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
$params = '/format/json/id/#id#/type/#type#';
|
$params = '/format/json/id/#id#/type/#type#';
|
||||||
|
|
||||||
|
@ -79,7 +81,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$file_id = $this->_getParam('id', null);
|
$file_id = $this->_getParam('id', null);
|
||||||
$file = StoredFile::Recall($file_id);
|
$file = StoredFile::Recall($file_id);
|
||||||
|
|
||||||
$url = $file->getRelativeFileUrl().'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true';
|
$url = $file->getRelativeFileUrl($baseUrl).'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true';
|
||||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
||||||
'title' => 'Download');
|
'title' => 'Download');
|
||||||
|
|
||||||
|
|
|
@ -449,10 +449,9 @@ class StoredFile {
|
||||||
* Sometimes we want a relative URL and not a full URL. See bug
|
* Sometimes we want a relative URL and not a full URL. See bug
|
||||||
* http://dev.sourcefabric.org/browse/CC-2403
|
* http://dev.sourcefabric.org/browse/CC-2403
|
||||||
*/
|
*/
|
||||||
public function getRelativeFileUrl()
|
public function getRelativeFileUrl($baseUrl)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
return $baseUrl."/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
||||||
return "api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function Insert($md=null)
|
public static function Insert($md=null)
|
||||||
|
|
Loading…
Reference in New Issue