X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/8c945034b9f12e728c601502e730d2cfe4c937cf..refs/pull/3918/head:/tests/Uploads/ImageTest.php diff --git a/tests/Uploads/ImageTest.php b/tests/Uploads/ImageTest.php index e929d63ec..0e4065a82 100644 --- a/tests/Uploads/ImageTest.php +++ b/tests/Uploads/ImageTest.php @@ -310,7 +310,7 @@ class ImageTest extends TestCase } } - public function test_system_images_remain_public() + public function test_system_images_remain_public_with_local_secure() { config()->set('filesystems.images', 'local_secure'); $this->asAdmin(); @@ -327,6 +327,23 @@ class ImageTest extends TestCase } } + public function test_system_images_remain_public_with_local_secure_restricted() + { + config()->set('filesystems.images', 'local_secure_restricted'); + $this->asAdmin(); + $galleryFile = $this->getTestImage('my-system-test-restricted-upload.png'); + $expectedPath = public_path('uploads/images/system/' . date('Y-m') . '/my-system-test-restricted-upload.png'); + + $upload = $this->call('POST', '/settings/customization', [], [], ['app_logo' => $galleryFile], []); + $upload->assertRedirect('/settings/customization'); + + $this->assertTrue(file_exists($expectedPath), 'Uploaded image not found at path: ' . $expectedPath); + + if (file_exists($expectedPath)) { + unlink($expectedPath); + } + } + public function test_secure_restricted_images_inaccessible_without_relation_permission() { config()->set('filesystems.images', 'local_secure_restricted');