0011898: Download links missing server subdir part
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 9 Jun 2016 16:37:46 +0000 (18:37 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 16 Jun 2016 10:10:07 +0000 (12:10 +0200)
* make use of new Tinebase_Core::getUrl()
* 'full' is default part for getUrl()

https://forge.tine20.org/view.php?id=11898

Change-Id: I91076e42d4f4ad44a3ac6114677153c80b43ed81
Reviewed-on: http://gerrit.tine20.com/customers/3245
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Filemanager/Frontend/JsonTests.php
tine20/Filemanager/Model/DownloadLink.php

index be8ef68..0f01453 100644 (file)
@@ -1362,11 +1362,16 @@ class Filemanager_Frontend_JsonTests extends TestCase
         $result = $this->_json->saveDownloadLink($downloadLinkData);
         
         $this->assertTrue(! empty($result['url']));
-        $this->assertEquals(Tinebase_Core::getHostname() . '/download/show/' . $result['id'], $result['url']);
+        $this->assertEquals($this->_getDownloadUrl($result['id']), $result['url']);
         $this->assertEquals(0, $result['access_count']);
         
         return $result;
     }
+
+    protected function _getDownloadUrl($id)
+    {
+        return Tinebase_Core::getUrl() . '/download/show/' . $id;
+    }
     
     /**
      * testSaveDownloadLinkDirectory
@@ -1379,7 +1384,7 @@ class Filemanager_Frontend_JsonTests extends TestCase
         $result = $this->_json->saveDownloadLink($downloadLinkData);
         
         $this->assertTrue(! empty($result['url']));
-        $this->assertEquals(Tinebase_Core::getHostname() . '/download/show/' . $result['id'], $result['url']);
+        $this->assertEquals($this->_getDownloadUrl($result['id']), $result['url']);
         
         return $result;
     }
index 7b8d4e4..f7d495c 100644 (file)
@@ -73,7 +73,7 @@ class Filemanager_Model_DownloadLink extends Tinebase_Record_Abstract
         
         // always set url here (or is there a better place?)
         if ($this->getId()) {
-            $this->url = Tinebase_Core::getHostname() . '/download/show/' . $this->getId();
+            $this->url = Tinebase_Core::getUrl() . '/download/show/' . $this->getId();
         }
     }