Ignore unavailable app on foreign route call#20038
Closed
nickvergessen wants to merge 1 commit intomasterfrom
Closed
Ignore unavailable app on foreign route call#20038nickvergessen wants to merge 1 commit intomasterfrom
nickvergessen wants to merge 1 commit intomasterfrom
Conversation
Signed-off-by: Joas Schilling <coding@schilljs.com>
Member
Author
|
The alternate patch would be: diff --git a/core/routes.php b/core/routes.php
index 5fb13bc298..1796a817ec 100644
--- a/core/routes.php
+++ b/core/routes.php
@@ -95,8 +95,8 @@ $application->registerRoutes($this, [
['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'],
- ['name' => 'pagecontroller#showCall', 'url' => '/call/{token}', 'verb' => 'GET', 'app' => 'spreed'],
- ['name' => 'pagecontroller#authenticatePassword', 'url' => '/call/{token}', 'verb' => 'POST', 'app' => 'spreed'],
+// ['name' => 'pagecontroller#showCall', 'url' => '/call/{token}', 'verb' => 'GET', 'app' => 'spreed'],
+// ['name' => 'pagecontroller#authenticatePassword', 'url' => '/call/{token}', 'verb' => 'POST', 'app' => 'spreed'],
],
'ocs' => [
['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
diff --git a/lib/private/AppFramework/Routing/RouteConfig.php b/lib/private/AppFramework/Routing/RouteConfig.php
index ec6c397155..9d4d9fbd47 100644
--- a/lib/private/AppFramework/Routing/RouteConfig.php
+++ b/lib/private/AppFramework/Routing/RouteConfig.php
@@ -147,8 +147,12 @@ class RouteConfig {
foreach ($simpleRoutes as $simpleRoute) {
$name = $simpleRoute['name'];
$postfix = $simpleRoute['postfix'] ?? '';
+ $root = $simpleRoute['root'] ?? '/apps/' . $this->appName;
+ if ($this->appName === 'core') {
+ $root = '';
+ }
- $url = $simpleRoute['url'];
+ $url = $root . $simpleRoute['url'];
$verb = strtoupper($simpleRoute['verb'] ?? 'GET');
$split = explode('#', $name, 2);
diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php
index 5b73a1f697..a04c6f5218 100644
--- a/lib/private/Route/Router.php
+++ b/lib/private/Route/Router.php
@@ -151,7 +151,7 @@ class Router implements IRouter {
$this->useCollection($app);
$this->requireRouteFile($file, $app);
$collection = $this->getCollection($app);
- $collection->addPrefix('/apps/' . $app);
+ $collection->addPrefix('');
$this->root->addCollection($collection);
// Also add the OCS collection
and in talk: diff --git a/appinfo/routes.php b/appinfo/routes.php
index f0729ba8..0519f423 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -28,6 +28,18 @@ return [
'url' => '/',
'verb' => 'GET',
],
+ [
+ 'name' => 'Page#showCall',
+ 'url' => '/call/{token}',
+ 'verb' => 'GET',
+ 'root' => '',
+ ],
+ [
+ 'name' => 'Page#authenticatePassword',
+ 'url' => '/call/{token}',
+ 'verb' => 'POST',
+ 'root' => '',
+ ],
],
'ocs' => [
/** |
Member
Yeah. I'm still a bit hessitant as it might lead to conflicting routes etc. |
Member
Author
|
So closing in favor of #20114 Might have a look at it for 18 thou |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Turns out with non default apps_path the Talk installation still fails because the path is wrong invalid causing double namespace registration again.
Fix nextcloud/spreed#2806
I'm very close to just killing the restriction for apps instead to have their prefix, and just do the same as with ocs routes, just allow it for apps to be in root but don't promote it. If they don't specify a
rootwe fall back to theapps/{id}like before...