]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix creation of legacy routes
authorJoas Schilling <coding@schilljs.com>
Mon, 23 Mar 2020 16:00:41 +0000 (17:00 +0100)
committerRoeland Jago Douma <roeland@famdouma.nl>
Sat, 18 Apr 2020 09:21:28 +0000 (11:21 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/Route/Router.php

index 9c6e69908e77afa1345934598b37049150b6aa3e..075b81224ad79de03d51b92ad84e1db384be3338 100644 (file)
@@ -335,6 +335,7 @@ class Router implements IRouter {
                        if ($absolute === false) {
                                $referenceType = UrlGenerator::ABSOLUTE_PATH;
                        }
+                       $name = $this->fixLegacyRootName($name);
                        return $this->getGenerator()->generate($name, $parameters, $referenceType);
                } catch (RouteNotFoundException $e) {
                        $this->logger->logException($e);
@@ -342,6 +343,34 @@ class Router implements IRouter {
                }
        }
 
+       protected function fixLegacyRootName(string $routeName): string {
+               if ($routeName === 'files.viewcontroller.showFile') {
+                       return 'files.View.showFile';
+               }
+               if ($routeName === 'files_sharing.sharecontroller.showShare') {
+                       return 'files_sharing.Share.showShare';
+               }
+               if ($routeName === 'files_sharing.sharecontroller.showAuthenticate') {
+                       return 'files_sharing.Share.showAuthenticate';
+               }
+               if ($routeName === 'files_sharing.sharecontroller.authenticate') {
+                       return 'files_sharing.Share.authenticate';
+               }
+               if ($routeName === 'files_sharing.sharecontroller.downloadShare') {
+                       return 'files_sharing.Share.downloadShare';
+               }
+               if ($routeName === 'files_sharing.publicpreview.directLink') {
+                       return 'files_sharing.PublicPreview.directLink';
+               }
+               if ($routeName === 'cloud_federation_api.requesthandlercontroller.addShare') {
+                       return 'cloud_federation_api.RequestHandler.addShare';
+               }
+               if ($routeName === 'cloud_federation_api.requesthandlercontroller.receiveNotification') {
+                       return 'cloud_federation_api.RequestHandler.receiveNotification';
+               }
+               return $routeName;
+       }
+
        /**
         * To isolate the variable scope used inside the $file it is required in it's own method
         *