Skip to content

Commit

Permalink
Merge pull request #4282 from nextcloud/backport/4195/stable28
Browse files Browse the repository at this point in the history
[stable28] fix(share): link share of federated share
  • Loading branch information
juliusknorr authored Nov 28, 2024
2 parents 0353447 + d89aced commit f42e52a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions cypress/e2e/share-federated.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe('Federated sharing of office documents', function() {
cy.createUser(shareOwner)

cy.uploadFile(shareOwner, 'document.odt', 'application/vnd.oasis.opendocument.text', '/document.odt')
cy.uploadFile(shareOwner, 'document.odt', 'application/vnd.oasis.opendocument.text', '/document-reshare.odt')
})

it('Open a remotely shared file', function() {
Expand All @@ -37,4 +38,23 @@ describe('Federated sharing of office documents', function() {
cy.get('#viewer', { timeout: 5000 }).should('not.exist')
})
})

it('Open a remotely shared file as a link', function() {
cy.login(shareOwner)
cy.shareFileToRemoteUser(shareOwner, '/document-reshare.odt', shareRecipient)

cy.login(shareRecipient)
cy.visit('/apps/files')

cy.shareLink(shareRecipient, '/document-reshare.odt', { permissions: 1 }).then((token) => {
cy.logout()
cy.visit(`/s/${token}`, {
onBeforeLoad(win) {
cy.spy(win, 'postMessage').as('postMessage')
},
})
cy.waitForViewer()
cy.waitForCollabora(true, true)
})
})
})
1 change: 1 addition & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ Cypress.Commands.add('shareFileToRemoteUser', (user, path, targetUser, shareData
body: {
path,
shareType: 6,
permission: 31,
shareWith: federatedId,
...shareData,
},
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/DocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public function token(int $fileId, ?string $shareToken = null, ?string $path = n
$share = $shareToken ? $this->shareManager->getShareByToken($shareToken) : null;
$file = $shareToken ? $this->getFileForShare($share, $fileId, $path) : $this->getFileForUser($fileId, $path);

$federatedUrl = $this->federationService->getRemoteRedirectURL($file);
$federatedUrl = $this->federationService->getRemoteRedirectURL($file, null, $share);
if ($federatedUrl) {
return new DataResponse([
'federatedUrl' => $federatedUrl,
Expand Down

0 comments on commit f42e52a

Please sign in to comment.