Issue #2096855 by zero2one: Fixed FilterHtmlImageSecure does not support images with spaces in the filename.
parent
1cdfe372c8
commit
83cbb3412c
|
@ -1391,6 +1391,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;
|
||||
|
|
|
@ -94,6 +94,12 @@ class FilterHtmlImageSecureTest extends WebTestBase {
|
|||
$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_image = rawurlencode($special_filename);
|
||||
$special_uri = str_replace($test_images[0]->filename, $special_filename, $test_images[0]->uri);
|
||||
file_unmanaged_copy($test_images[0]->uri, $special_uri);
|
||||
|
||||
// Create a list of test image sources.
|
||||
// The keys become the value of the IMG 'src' attribute, the values are the
|
||||
// expected filter conversions.
|
||||
|
@ -111,6 +117,8 @@ class FilterHtmlImageSecureTest extends WebTestBase {
|
|||
$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,
|
||||
|
|
Loading…
Reference in New Issue