]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Raise 404 error instead of 500 if permalink access is denied 1613/head
authorArthurHoaro <arthur@hoa.ro>
Wed, 28 Oct 2020 11:54:52 +0000 (12:54 +0100)
committerArthurHoaro <arthur@hoa.ro>
Wed, 28 Oct 2020 12:16:18 +0000 (13:16 +0100)
application/bookmark/BookmarkFileService.php
tests/bookmark/BookmarkFileServiceTest.php

index 0df2f47f7e6d3fb4aad5ebbfa8d16253a59089a3..3ea98a45d6bf24c1ce501826d7dc84455bdae5ee 100644 (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;
index 8e0ff8dd0281f0021e728133d12a039c34478f0e..f619aff3f7865d7aebddcd4fb06622b52521b2e0 100644 (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);