From 8f0b965ea03263cfe7067b88d529e4fdd4c117bf Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 22 Jun 2011 16:50:58 -0400 Subject: [PATCH] CC-2403: Downloading a file via the web UI returns an absolute path, not relative -fixed --- .../application/controllers/LibraryController.php | 2 +- airtime_mvc/application/models/StoredFile.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index 04cddcd08..5219e8567 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -79,7 +79,7 @@ class LibraryController extends Zend_Controller_Action $file_id = $this->_getParam('id', null); $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), 'title' => 'Download'); diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 90c0152c8..e7a062c61 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -445,6 +445,16 @@ class StoredFile { 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) { $file = new CcFiles();