From f7e26d8728c6475f4cac51d054140ea30955809e Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Fri, 27 Oct 2023 19:12:21 +0200 Subject: [PATCH 1/2] Use a custom exception message when failing to get image size --- .../src/Framework/Features/Blogging/Models/FeaturedImage.php | 2 +- packages/framework/tests/Unit/FeaturedImageUnitTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/framework/src/Framework/Features/Blogging/Models/FeaturedImage.php b/packages/framework/src/Framework/Features/Blogging/Models/FeaturedImage.php index d2b68603e54..25f80a2b3c5 100644 --- a/packages/framework/src/Framework/Features/Blogging/Models/FeaturedImage.php +++ b/packages/framework/src/Framework/Features/Blogging/Models/FeaturedImage.php @@ -217,7 +217,7 @@ protected function getContentLengthForLocalImage(): int $storagePath = Hyde::mediaPath($this->source); if (! file_exists($storagePath)) { - throw new FileNotFoundException(sprintf('Image at %s does not exist', Hyde::pathToRelative($storagePath))); + throw new FileNotFoundException(customMessage: sprintf('Featured image [%s] not found.', Hyde::pathToRelative($storagePath))); } return filesize($storagePath); diff --git a/packages/framework/tests/Unit/FeaturedImageUnitTest.php b/packages/framework/tests/Unit/FeaturedImageUnitTest.php index e5fea9fc33e..3fae872b5e9 100644 --- a/packages/framework/tests/Unit/FeaturedImageUnitTest.php +++ b/packages/framework/tests/Unit/FeaturedImageUnitTest.php @@ -124,7 +124,7 @@ public function testGetContentLength() public function testFeaturedImageGetContentLengthWithNoSource() { $this->expectException(FileNotFoundException::class); - $this->expectExceptionMessage('Image at _media/foo does not exist'); + $this->expectExceptionMessage('Featured image [_media/foo] not found.'); $image = new FeaturedImage('_media/foo', ...$this->defaultArguments()); $this->assertEquals(0, $image->getContentLength()); From bc2f6041dc4c3e1f98a8c55dce2296e6b09925b9 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Fri, 27 Oct 2023 19:26:35 +0200 Subject: [PATCH 2/2] Update RELEASE_NOTES.md --- RELEASE_NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c1ee17ed5da..1883d530bf2 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -30,6 +30,7 @@ This serves two purposes: - Updated dropdown navigation menus to support setting priority in config in https://github.com/hydephp/develop/pull/1387 (fixing https://github.com/hydephp/hyde/issues/229) - Updated the vendor publish command to support parent Laravel Prompts implementation in https://github.com/hydephp/develop/pull/1388 - Fixed wrong version constant in https://github.com/hydephp/develop/pull/1391 +- Fixed improperly formatted exception message in https://github.com/hydephp/develop/pull/1399 ### Security - in case of vulnerabilities.