Skip to content

Commit f42e52a

Browse files
authored
Merge pull request #4282 from nextcloud/backport/4195/stable28
[stable28] fix(share): link share of federated share
2 parents 0353447 + d89aced commit f42e52a

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

cypress/e2e/share-federated.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe('Federated sharing of office documents', function() {
1616
cy.createUser(shareOwner)
1717

1818
cy.uploadFile(shareOwner, 'document.odt', 'application/vnd.oasis.opendocument.text', '/document.odt')
19+
cy.uploadFile(shareOwner, 'document.odt', 'application/vnd.oasis.opendocument.text', '/document-reshare.odt')
1920
})
2021

2122
it('Open a remotely shared file', function() {
@@ -37,4 +38,23 @@ describe('Federated sharing of office documents', function() {
3738
cy.get('#viewer', { timeout: 5000 }).should('not.exist')
3839
})
3940
})
41+
42+
it('Open a remotely shared file as a link', function() {
43+
cy.login(shareOwner)
44+
cy.shareFileToRemoteUser(shareOwner, '/document-reshare.odt', shareRecipient)
45+
46+
cy.login(shareRecipient)
47+
cy.visit('/apps/files')
48+
49+
cy.shareLink(shareRecipient, '/document-reshare.odt', { permissions: 1 }).then((token) => {
50+
cy.logout()
51+
cy.visit(`/s/${token}`, {
52+
onBeforeLoad(win) {
53+
cy.spy(win, 'postMessage').as('postMessage')
54+
},
55+
})
56+
cy.waitForViewer()
57+
cy.waitForCollabora(true, true)
58+
})
59+
})
4060
})

cypress/support/commands.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ Cypress.Commands.add('shareFileToRemoteUser', (user, path, targetUser, shareData
133133
body: {
134134
path,
135135
shareType: 6,
136+
permission: 31,
136137
shareWith: federatedId,
137138
...shareData,
138139
},

lib/Controller/DocumentController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ public function token(int $fileId, ?string $shareToken = null, ?string $path = n
393393
$share = $shareToken ? $this->shareManager->getShareByToken($shareToken) : null;
394394
$file = $shareToken ? $this->getFileForShare($share, $fileId, $path) : $this->getFileForUser($fileId, $path);
395395

396-
$federatedUrl = $this->federationService->getRemoteRedirectURL($file);
396+
$federatedUrl = $this->federationService->getRemoteRedirectURL($file, null, $share);
397397
if ($federatedUrl) {
398398
return new DataResponse([
399399
'federatedUrl' => $federatedUrl,

0 commit comments

Comments
 (0)