Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directly redirect to federated URL in direct editing #3514

Open
juliushaertl opened this issue Mar 7, 2024 · 0 comments
Open

Directly redirect to federated URL in direct editing #3514

juliushaertl opened this issue Mar 7, 2024 · 0 comments
Labels
1. to develop Waiting for a developer technical debt

Comments

@juliushaertl
Copy link
Member

When discussing with @tobiasKaminsky we figured out we could potentially send back the remote URL directly for direct editing to avoid a redirect

Potential patch needs testing:

diff --git a/lib/Controller/OCSController.php b/lib/Controller/OCSController.php
index 50504f15..cd0b65cb 100644
--- a/lib/Controller/OCSController.php
+++ b/lib/Controller/OCSController.php
@@ -119,15 +119,15 @@ class OCSController extends \OCP\AppFramework\OCSController {
                        }

                        $node = $nodes[0];
-                       if ($node instanceof Folder) {
+                       if (!$node instanceof File) {
                                throw new OCSBadRequestException('Cannot view folder');
                        }

                        $direct = $this->directMapper->newDirect($this->userId, $fileId);
-
+                       $federatedUrl = $this->federationService->getRemoteRedirectURL($node, $direct);
                        return new DataResponse([
                                'url' => $this->urlGenerator->linkToRouteAbsolute('richdocuments.directView.show', [
-                                       'token' => $direct->getToken()
+                                       'token' => $federatedUrl ?: $direct->getToken(),
                                ])
                        ]);
                } catch (NotFoundException $e) {
@juliushaertl juliushaertl added 1. to develop Waiting for a developer technical debt labels Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Waiting for a developer technical debt
Projects
None yet
Development

No branches or pull requests

1 participant