diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index ea98965..291163f 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -1400,6 +1400,7 @@ function _filter_html_image_secure_process($text) { // Ensure the path refers to an actual image by prefixing the image source // with the Drupal root and running getimagesize() on it. $local_image_path = $local_dir . drupal_substr($src, $base_path_length); + $local_image_path = rawurldecode($local_image_path); if (@getimagesize($local_image_path)) { // The image has the right path. Erroneous images are dealt with below. continue; diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php index d61bfa1..95e9e0d 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php @@ -92,6 +92,12 @@ function testImageSource() { $test_images = $this->drupalGetTestFiles('image'); $test_image = $test_images[0]->filename; + // Put a test image in the files directory with special filename + $special_filename = 'tést fïle nàme.png'; + $special_base_uri = str_replace($test_images[0]->filename, NULL, $test_images[0]->uri); + $special_image = rawurlencode($special_filename); + file_unmanaged_copy($test_images[0]->uri, $special_base_uri . $special_filename); + // Create a list of test image sources. // The keys become the value of the IMG 'src' attribute, the values are the // expected filter conversions. @@ -102,6 +108,8 @@ function testImageSource() { $files_path . '/' . $test_image => $files_path . '/' . $test_image, $http_base_url . '/' . $public_files_path . '/' . $test_image => $files_path . '/' . $test_image, $https_base_url . '/' . $public_files_path . '/' . $test_image => $files_path . '/' . $test_image, + $http_base_url . '/' . $public_files_path . '/' . $special_image => $files_path . '/' . $special_image, + $https_base_url . '/' . $public_files_path . '/' . $special_image => $files_path . '/' . $special_image, $files_path . '/example.png' => $red_x_image, 'http://example.com/' . $druplicon => $red_x_image, 'https://example.com/' . $druplicon => $red_x_image, diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php old mode 100644 new mode 100755