- Issue created by @erichomanchuk
- Merge request !16Update path processor to replace periods with double underscores → (Merged) created by erichomanchuk
- 🇫🇷France DrDam
As first approach, it's good for me, thanks
fixed in 2.1.7
If the image filename has a period in it like "somefile.portrait.jpg" the period get replaced with double underscore "somefile__portrait__jpg" but on the PathProcessor the validation is against the filename without the double underscore
// Ensure Crop Target and Requested Image are the same.
$path_parts = pathinfo($crop_uri);
$crop_target_filename = $path_parts['dirname'] . '/' . $path_parts['filename'] . '__' . $path_parts['extension'];
if ($original_image_path != $crop_target_filename) {
throw new NotFoundHttpException();
}
Add an image with a period in the file name
Not sure if it's best to change the MediaContextualCropService class to not transform the period and to leave it or to transform the period in the PathProcessorImageStyles class to convert the file name to have the double underscore. I propose to update PathProcessorImageStyles as it is simpler
// Ensure Crop Target and Requested Image are the same.
$path_parts = pathinfo($crop_uri);
$crop_target_filename = $path_parts['dirname'] . '/' . str_replace('.', '__', $path_parts['filename']) . '__' . $path_parts['extension'];
if ($original_image_path != $crop_target_filename) {
throw new NotFoundHttpException();
}
Active
2.1
Code
As first approach, it's good for me, thanks
fixed in 2.1.7