Raise 404 error instead of 500 if permalink access is denied

This commit is contained in:
ArthurHoaro 2020-10-28 12:54:52 +01:00
parent 34c8f558e5
commit 156061d445
2 changed files with 3 additions and 3 deletions

View file

@ -106,7 +106,7 @@ class BookmarkFileService implements BookmarkServiceInterface
&& $first->isPrivate()
&& (empty($privateKey) || $privateKey !== $first->getAdditionalContentEntry('private_key'))
) {
throw new Exception('Not authorized');
throw new BookmarkNotFoundException();
}
return $first;

View file

@ -886,8 +886,8 @@ class BookmarkFileServiceTest extends TestCase
*/
public function testFilterHashPrivateWhileLoggedOut()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Not authorized');
$this->expectException(BookmarkNotFoundException::class);
$this->expectExceptionMessage('The link you are trying to reach does not exist or has been deleted');
$hash = smallHash('20141125_084734' . 6);