Strip of users home path from share api message

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2020-02-18 11:02:11 +01:00
Родитель a1fc233fcb
Коммит e97d643969
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7076EA9751AACDDA
2 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -289,7 +289,8 @@ class Manager implements IManager {
// Check if we actually have share permissions
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);
}
@ -333,7 +334,8 @@ class Manager implements IManager {
// Check that we do not share with more permissions than we have
if ($share->getPermissions() & ~$permissions) {
$message_t = $this->l->t('Cant increase permissions of %s', [$share->getNode()->getPath()]);
$path = $userFolder->getRelativePath($share->getNode()->getPath());
$message_t = $this->l->t('Cant increase permissions of %s', [$path]);
throw new GenericShareException($message_t, $message_t, 404);
}

Просмотреть файл

@ -708,6 +708,9 @@ class ManagerTest extends \Test\TestCase {
$userFolder = $this->createMock(Folder::class);
$userFolder->method('getPath')->willReturn('myrootfolder');
$userFolder->expects($this->any())
->method('getRelativePath')
->willReturnArgument(0);
$this->rootFolder->method('getUserFolder')->willReturn($userFolder);