CC-2403: Downloading a file via the web UI returns an absolute path, not relative
-fixed
This commit is contained in:
parent
532ba46cba
commit
8f0b965ea0
2 changed files with 11 additions and 1 deletions
|
@ -79,7 +79,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->getFileUrl().'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true';
|
$url = $file->getRelativeFileUrl().'/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');
|
||||||
|
|
||||||
|
|
|
@ -445,6 +445,16 @@ class StoredFile {
|
||||||
return "http://$CC_CONFIG[baseUrl]:$CC_CONFIG[basePort]/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
return "http://$CC_CONFIG[baseUrl]:$CC_CONFIG[basePort]/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sometimes we want a relative URL and not a full URL. See bug
|
||||||
|
* http://dev.sourcefabric.org/browse/CC-2403
|
||||||
|
*/
|
||||||
|
public function getRelativeFileUrl()
|
||||||
|
{
|
||||||
|
global $CC_CONFIG;
|
||||||
|
return "api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
||||||
|
}
|
||||||
|
|
||||||
public static function Insert($md=null)
|
public static function Insert($md=null)
|
||||||
{
|
{
|
||||||
$file = new CcFiles();
|
$file = new CcFiles();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue