diff --git a/core/modules/image/image.module b/core/modules/image/image.module index 29a18a7..a7696a6 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -562,7 +562,7 @@ function image_style_deliver($style, $scheme) { // Don't try to generate file if source is missing. if (!file_exists($image_uri)) { - watchdog('image', 'Unable to generate the derived image from image at %path.', array('%path' => $derivative_uri)); + watchdog('image', 'Source image at %source_image_path not found while trying to generate derivative image at %derivative_path.', array('%source_image_path' => $image_uri, '%derivative_path' => $derivative_uri)); return new Response(t('Error generating image, missing source file.'), 404); } diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php index 07ea3fb..ae550ae 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php @@ -91,6 +91,16 @@ function testImageStyleUrlExtraSlash() { } /** + * Tests that an invalid source image returns a 404. + */ + function testImageStyleUrlForMissingSourceImage() { + $non_existent_uri = 'public://foo.png'; + $generated_url = image_style_url($this->style_name, $non_existent_uri); + $this->drupalGet($generated_url); + $this->assertResponse(404, 'Accessing an image style URL with a source image that does not exist provides a 404 error response.'); + } + + /** * Tests image_style_url(). */ function _testImageStyleUrlAndPath($scheme, $clean_url = TRUE, $extra_slash = FALSE) {