Skip to content

Commit 7ded5a7

Browse files
committed
Only normalize data in public shares and not crud
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
1 parent f496e47 commit 7ded5a7

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

apps/files_sharing/lib/Controller/ShareAPIController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,9 @@ public function updateShare(
11871187
}
11881188

11891189
// normalize to correct public upload permissions
1190-
$newPermissions = Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE;
1190+
if ($publicUpload === 'true') {
1191+
$newPermissions = Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE;
1192+
}
11911193
}
11921194

11931195
if ($newPermissions !== null) {

apps/files_sharing/tests/Controller/ShareAPIControllerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3037,7 +3037,7 @@ public function publicUploadParamsProvider() {
30373037
// legacy had no delete
30383038
[
30393039
\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE,
3040-
null, null, 'password'
3040+
'true', null, 'password'
30413041
],
30423042
// correct
30433043
[
@@ -3538,7 +3538,7 @@ public function testUpdateLinkSharePermissions() {
35383538
$this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true);
35393539

35403540
$this->shareManager->expects($this->once())->method('updateShare')->with(
3541-
$this->callback(function (\OCP\Share\IShare $share) use ($date) {
3541+
$this->callback(function (\OCP\Share\IShare $share) use ($date): bool {
35423542
return $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE) &&
35433543
$share->getPassword() === 'password' &&
35443544
$share->getSendPasswordByTalk() === true &&
@@ -3567,7 +3567,7 @@ public function testUpdateLinkSharePermissions() {
35673567
->willReturn(42);
35683568

35693569
$expected = new DataResponse([]);
3570-
$result = $ocs->updateShare(42, 7, null, null, null, null, null, null, null);
3570+
$result = $ocs->updateShare(42, 7, null, null, 'true', null, null, null, null);
35713571

35723572
$this->assertInstanceOf(get_class($expected), $result);
35733573
$this->assertEquals($expected->getData(), $result->getData());

build/integration/sharing_features/sharing-v1.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ Feature: sharing
269269
| shareType | 3 |
270270
And Updating last share with
271271
| permissions | 7 |
272+
| publicUpload | true |
272273
And the OCS status code should be "100"
273274
And the HTTP status code should be "200"
274275
And Getting info of last share

0 commit comments

Comments
 (0)