use file name instead of path in 'not allowed to share' message
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
8021bacbdc
commit
f65a89dd07
|
@ -287,8 +287,7 @@ 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()) {
|
||||||
$path = $userFolder->getRelativePath($share->getNode()->getPath());
|
$message_t = $this->l->t('You are not allowed to share %s', [$share->getNode()->getName()]);
|
||||||
$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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -601,20 +601,22 @@ class ManagerTest extends \Test\TestCase {
|
||||||
$nonShareAble = $this->createMock(Folder::class);
|
$nonShareAble = $this->createMock(Folder::class);
|
||||||
$nonShareAble->method('isShareable')->willReturn(false);
|
$nonShareAble->method('isShareable')->willReturn(false);
|
||||||
$nonShareAble->method('getPath')->willReturn('path');
|
$nonShareAble->method('getPath')->willReturn('path');
|
||||||
|
$nonShareAble->method('getName')->willReturn('name');
|
||||||
$nonShareAble->method('getOwner')
|
$nonShareAble->method('getOwner')
|
||||||
->willReturn($owner);
|
->willReturn($owner);
|
||||||
$nonShareAble->method('getStorage')
|
$nonShareAble->method('getStorage')
|
||||||
->willReturn($storage);
|
->willReturn($storage);
|
||||||
|
|
||||||
$data[] = [$this->createShare(null, IShare::TYPE_USER, $nonShareAble, $user2, $user0, $user0, 31, null, null), 'You are not allowed to share path', true];
|
$data[] = [$this->createShare(null, IShare::TYPE_USER, $nonShareAble, $user2, $user0, $user0, 31, null, null), 'You are not allowed to share name', true];
|
||||||
$data[] = [$this->createShare(null, IShare::TYPE_GROUP, $nonShareAble, $group0, $user0, $user0, 31, null, null), 'You are not allowed to share path', true];
|
$data[] = [$this->createShare(null, IShare::TYPE_GROUP, $nonShareAble, $group0, $user0, $user0, 31, null, null), 'You are not allowed to share name', true];
|
||||||
$data[] = [$this->createShare(null, IShare::TYPE_LINK, $nonShareAble, null, $user0, $user0, 31, null, null), 'You are not allowed to share path', true];
|
$data[] = [$this->createShare(null, IShare::TYPE_LINK, $nonShareAble, null, $user0, $user0, 31, null, null), 'You are not allowed to share name', true];
|
||||||
|
|
||||||
$limitedPermssions = $this->createMock(File::class);
|
$limitedPermssions = $this->createMock(File::class);
|
||||||
$limitedPermssions->method('isShareable')->willReturn(true);
|
$limitedPermssions->method('isShareable')->willReturn(true);
|
||||||
$limitedPermssions->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ);
|
$limitedPermssions->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ);
|
||||||
$limitedPermssions->method('getId')->willReturn(108);
|
$limitedPermssions->method('getId')->willReturn(108);
|
||||||
$limitedPermssions->method('getPath')->willReturn('path');
|
$limitedPermssions->method('getPath')->willReturn('path');
|
||||||
|
$limitedPermssions->method('getName')->willReturn('name');
|
||||||
$limitedPermssions->method('getOwner')
|
$limitedPermssions->method('getOwner')
|
||||||
->willReturn($owner);
|
->willReturn($owner);
|
||||||
$limitedPermssions->method('getStorage')
|
$limitedPermssions->method('getStorage')
|
||||||
|
@ -637,6 +639,7 @@ class ManagerTest extends \Test\TestCase {
|
||||||
$nonMoveableMountPermssions->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ);
|
$nonMoveableMountPermssions->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ);
|
||||||
$nonMoveableMountPermssions->method('getId')->willReturn(108);
|
$nonMoveableMountPermssions->method('getId')->willReturn(108);
|
||||||
$nonMoveableMountPermssions->method('getPath')->willReturn('path');
|
$nonMoveableMountPermssions->method('getPath')->willReturn('path');
|
||||||
|
$nonMoveableMountPermssions->method('getName')->willReturn('name');
|
||||||
$nonMoveableMountPermssions->method('getOwner')
|
$nonMoveableMountPermssions->method('getOwner')
|
||||||
->willReturn($owner);
|
->willReturn($owner);
|
||||||
$nonMoveableMountPermssions->method('getStorage')
|
$nonMoveableMountPermssions->method('getStorage')
|
||||||
|
|
Loading…
Reference in New Issue