diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-09-15 17:43:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-15 17:43:01 +0300 |
commit | 02d55eb90fdc61137745c5e5b3d8c7330e0717c2 (patch) | |
tree | e560bf8b22e696f3dd0aaa73c6dd4ae083cc8a78 /apps | |
parent | 1013c3bf66803fd262fa2c82f5633af61305a151 (diff) | |
parent | 7ded5a769b7d7d681c3a3260b77869b18c9822ae (diff) |
Merge pull request #33941 from nextcloud/fix/public-sharing
Only normalize data in public shares and not crud
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 4 | ||||
-rw-r--r-- | apps/files_sharing/tests/Controller/ShareAPIControllerTest.php | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index ebc910063ef..003d9336af5 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -1187,7 +1187,9 @@ class ShareAPIController extends OCSController { } // normalize to correct public upload permissions - $newPermissions = Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE; + if ($publicUpload === 'true') { + $newPermissions = Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE; + } } if ($newPermissions !== null) { diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index f8f4fb18bc8..4ac4cd6956e 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -3037,7 +3037,7 @@ class ShareAPIControllerTest extends TestCase { // legacy had no delete [ \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE, - null, null, 'password' + 'true', null, 'password' ], // correct [ @@ -3538,7 +3538,7 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); $this->shareManager->expects($this->once())->method('updateShare')->with( - $this->callback(function (\OCP\Share\IShare $share) use ($date) { + $this->callback(function (\OCP\Share\IShare $share) use ($date): bool { return $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE) && $share->getPassword() === 'password' && $share->getSendPasswordByTalk() === true && @@ -3567,7 +3567,7 @@ class ShareAPIControllerTest extends TestCase { ->willReturn(42); $expected = new DataResponse([]); - $result = $ocs->updateShare(42, 7, null, null, null, null, null, null, null); + $result = $ocs->updateShare(42, 7, null, null, 'true', null, null, null, null); $this->assertInstanceOf(get_class($expected), $result); $this->assertEquals($expected->getData(), $result->getData()); |