diff --git a/apps/files/js/dist/personal-settings.js b/apps/files/js/dist/personal-settings.js index 20970e33ca..26b0e4b3df 100644 Binary files a/apps/files/js/dist/personal-settings.js and b/apps/files/js/dist/personal-settings.js differ diff --git a/apps/files/js/dist/personal-settings.js.map b/apps/files/js/dist/personal-settings.js.map index bbb3d37115..34ba027ae2 100644 Binary files a/apps/files/js/dist/personal-settings.js.map and b/apps/files/js/dist/personal-settings.js.map differ diff --git a/apps/files/lib/Controller/TransferOwnershipController.php b/apps/files/lib/Controller/TransferOwnershipController.php index 639e73187c..0b33e12e88 100644 --- a/apps/files/lib/Controller/TransferOwnershipController.php +++ b/apps/files/lib/Controller/TransferOwnershipController.php @@ -96,6 +96,10 @@ class TransferOwnershipController extends OCSController { return new DataResponse([], Http::STATUS_BAD_REQUEST); } + if ($node->getOwner()->getUID() !== $this->userId) { + return new DataResponse([], Http::STATUS_FORBIDDEN); + } + $transferOwnership = new TransferOwnershipEntity(); $transferOwnership->setSourceUser($this->userId); $transferOwnership->setTargetUser($recipient); diff --git a/apps/files/src/components/TransferOwnershipDialogue.vue b/apps/files/src/components/TransferOwnershipDialogue.vue index e88698c9a4..d6b56f118d 100644 --- a/apps/files/src/components/TransferOwnershipDialogue.vue +++ b/apps/files/src/components/TransferOwnershipDialogue.vue @@ -215,7 +215,11 @@ export default { .catch(error => { logger.error('Could not send ownership transfer request', { error }) - this.submitError = error.message || t('files', 'Unknown error') + if (error?.response?.status === 403) { + this.submitError = t('files', 'Cannot transfter ownership of a file or folder you don\'t own') + } else { + this.submitError = error.message || t('files', 'Unknown error') + } }) }, },