]> source.dussan.org Git - nextcloud-server.git/commitdiff
Change the route generation of AuthPublicShareController.php and adjust the routes...
authorTim Obert <tobert@w-commerce.de>
Fri, 14 Feb 2020 11:12:04 +0000 (12:12 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Sun, 23 Feb 2020 15:45:50 +0000 (15:45 +0000)
Signed-off-by: Tim Obert <tobert@w-commerce.de>
core/routes.php
lib/public/AppFramework/AuthPublicShareController.php

index 829fa8576c87800f94ef1aeda9099ae1fb076228..f802b64448515b2ae2f6bf72c8dfe42ca9665a9d 100644 (file)
@@ -86,10 +86,10 @@ $application->registerRoutes($this, [
 
                // Legacy routes that need to be globally available while they are handled by an app
                ['name' => 'viewcontroller#showFile', 'url' => '/f/{fileid}', 'verb' => 'GET', 'app' => 'files'],
-               ['name' => 'sharecontroller#showShare', 'url' => '/s/{token}', 'verb' => 'GET', 'app' => 'files_sharing'],
-               ['name' => 'sharecontroller#showAuthenticate', 'url' => '/s/{token}/authenticate/{redirect}', 'verb' => 'GET', 'app' => 'files_sharing'],
-               ['name' => 'sharecontroller#authenticate', 'url' => '/s/{token}/authenticate/{redirect}', 'verb' => 'POST', 'app' => 'files_sharing'],
-               ['name' => 'sharecontroller#downloadShare', 'url' => '/s/{token}/download', 'verb' => 'GET', 'app' => 'files_sharing'],
+               ['name' => 'share#showShare', 'url' => '/s/{token}', 'verb' => 'GET', 'app' => 'files_sharing'],
+               ['name' => 'share#showAuthenticate', 'url' => '/s/{token}/authenticate/{redirect}', 'verb' => 'GET', 'app' => 'files_sharing'],
+               ['name' => 'share#authenticate', 'url' => '/s/{token}/authenticate/{redirect}', 'verb' => 'POST', 'app' => 'files_sharing'],
+               ['name' => 'share#downloadShare', 'url' => '/s/{token}/download', 'verb' => 'GET', 'app' => 'files_sharing'],
                ['name' => 'publicpreview#directLink', 'url' => '/s/{token}/preview', 'verb' => 'GET', 'app' => 'files_sharing'],
                ['name' => 'requesthandlercontroller#addShare', 'url' => '/ocm/shares', 'verb' => 'POST', 'app' => 'cloud_federation_api'],
                ['name' => 'requesthandlercontroller#receiveNotification', 'url' => '/ocm/notifications', 'verb' => 'POST', 'app' => 'cloud_federation_api'],
index 37a8cedcd7e2642c8921a994185a6335d4fb91c1..8bc2da301c2adcb39b2c5bc9fb05a92c6658f07a 100644 (file)
@@ -156,14 +156,24 @@ abstract class AuthPublicShareController extends PublicShareController {
                );
        }
 
+       /**
+        * @param $string
+        * @return string
+        */
+       private function camelCaseToLowerCaseUnderscored($string)
+       {
+               $value = preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $string);
+               return mb_strtolower($value, 'utf-8');
+       }
+
        /**
         * @since 14.0.0
         */
        private function getRoute(string $function): string {
                $app = strtolower($this->appName);
-               $class = strtolower((new \ReflectionClass($this))->getShortName());
-
-               return $app . '.' . $class . '.' . $function;
+               $class = (new \ReflectionClass($this))->getShortName();
+               // $class = $this->camelCaseToLowerCaseUnderscored(substr($class, 0, strpos($class, 'Controller')));
+               return $app .'.'. $class .'.'. $function;
        }
 
        /**