Merge pull request #19528 from nextcloud/bugfix/noid/remove-user-root-from-error-message
Strip of users home path from share api message
This commit is contained in:
commit
ab7f6dd3f5
|
@ -289,7 +289,8 @@ class Manager implements IManager {
|
||||||
|
|
||||||
// Check if we actually have share permissions
|
// Check if we actually have share permissions
|
||||||
if (!$share->getNode()->isShareable()) {
|
if (!$share->getNode()->isShareable()) {
|
||||||
$message_t = $this->l->t('You are not allowed to share %s', [$share->getNode()->getPath()]);
|
$path = $userFolder->getRelativePath($share->getNode()->getPath());
|
||||||
|
$message_t = $this->l->t('You are not allowed to share %s', [$path]);
|
||||||
throw new GenericShareException($message_t, $message_t, 404);
|
throw new GenericShareException($message_t, $message_t, 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +334,8 @@ class Manager implements IManager {
|
||||||
|
|
||||||
// Check that we do not share with more permissions than we have
|
// Check that we do not share with more permissions than we have
|
||||||
if ($share->getPermissions() & ~$permissions) {
|
if ($share->getPermissions() & ~$permissions) {
|
||||||
$message_t = $this->l->t('Can’t increase permissions of %s', [$share->getNode()->getPath()]);
|
$path = $userFolder->getRelativePath($share->getNode()->getPath());
|
||||||
|
$message_t = $this->l->t('Can’t increase permissions of %s', [$path]);
|
||||||
throw new GenericShareException($message_t, $message_t, 404);
|
throw new GenericShareException($message_t, $message_t, 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -708,6 +708,9 @@ class ManagerTest extends \Test\TestCase {
|
||||||
|
|
||||||
$userFolder = $this->createMock(Folder::class);
|
$userFolder = $this->createMock(Folder::class);
|
||||||
$userFolder->method('getPath')->willReturn('myrootfolder');
|
$userFolder->method('getPath')->willReturn('myrootfolder');
|
||||||
|
$userFolder->expects($this->any())
|
||||||
|
->method('getRelativePath')
|
||||||
|
->willReturnArgument(0);
|
||||||
$this->rootFolder->method('getUserFolder')->willReturn($userFolder);
|
$this->rootFolder->method('getUserFolder')->willReturn($userFolder);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue