diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-07-04 15:25:24 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-07-04 15:25:24 +0200 |
commit | 2327d41b11e11ca0553c829b5d7adeb0f000a474 (patch) | |
tree | 8ed247cc2588e3553a32fe413dfaaaa05a9002b8 /lib | |
parent | 2b76db81ea81693c1d2754e882fc1f372e204c37 (diff) | |
parent | 5a588333b236519aed449a309be818d0686edb3a (diff) | |
download | nextcloud-server-2327d41b11e11ca0553c829b5d7adeb0f000a474.tar.gz nextcloud-server-2327d41b11e11ca0553c829b5d7adeb0f000a474.zip |
Merge pull request #9269 from owncloud/fix_versions_preview
change order of registering api and capabilities to fix file version previews
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/api.php | 2 | ||||
-rw-r--r-- | lib/private/route/router.php | 16 | ||||
-rw-r--r-- | lib/public/route/irouter.php | 7 |
3 files changed, 25 insertions, 0 deletions
diff --git a/lib/private/api.php b/lib/private/api.php index e9c144564f0..f5576af2ad8 100644 --- a/lib/private/api.php +++ b/lib/private/api.php @@ -65,6 +65,7 @@ class OC_API { $name = strtolower($method).$url; $name = str_replace(array('/', '{', '}'), '_', $name); if(!isset(self::$actions[$name])) { + $oldCollection = OC::$server->getRouter()->getCurrentCollection(); OC::$server->getRouter()->useCollection('ocs'); OC::$server->getRouter()->create($name, $url) ->method($method) @@ -72,6 +73,7 @@ class OC_API { ->requirements($requirements) ->action('OC_API', 'call'); self::$actions[$name] = array(); + OC::$server->getRouter()->useCollection($oldCollection); } self::$actions[$name][] = array('app' => $app, 'action' => $action, 'authlevel' => $authLevel); } diff --git a/lib/private/route/router.php b/lib/private/route/router.php index f3a4bc5f3e4..9c973d7ac6a 100644 --- a/lib/private/route/router.php +++ b/lib/private/route/router.php @@ -26,6 +26,11 @@ class Router implements IRouter { protected $collection = null; /** + * @var string + */ + protected $collectionName = null; + + /** * @var \Symfony\Component\Routing\RouteCollection */ protected $root = null; @@ -160,8 +165,19 @@ class Router implements IRouter { */ public function useCollection($name) { $this->collection = $this->getCollection($name); + $this->collectionName = $name; + } + + /** + * returns the current collection name in use for adding routes + * + * @return string the collection name + */ + public function getCurrentCollection() { + return $this->collectionName; } + /** * Create a \OC\Route\Route. * diff --git a/lib/public/route/irouter.php b/lib/public/route/irouter.php index 1c003c7b4b9..daa1632e0c8 100644 --- a/lib/public/route/irouter.php +++ b/lib/public/route/irouter.php @@ -37,6 +37,13 @@ interface IRouter { public function useCollection($name); /** + * returns the current collection name in use for adding routes + * + * @return string the collection name + */ + public function getCurrentCollection(); + + /** * Create a \OCP\Route\IRoute. * * @param string $name Name of the route to create. |