nextcloud / nextcloud/richdocuments
Directly redirect to federated URL in direct editing
Open
Nobody has claimed this yet.
1. to develop
feature: direct editor
feature: federation
technical debt
- Dominant language
- JavaScript
- Stars
- 453
- Forks
- 147
- Avg merge
- 14h 54m
- Merged PRs (30d)
- 83
Description
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) {
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/Controller/OCSController.php around the direct-editing response and inspect how DirectMapper and federationService provide the URL. Verify the federated case returns the remote URL directly while local editing still uses the direct-view route, then add or run tests for both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100