Skip to content

Commit

Permalink
Paranoid handling of the incoming $pathOrUrl
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Welch <[email protected]>
  • Loading branch information
khalwat committed Aug 13, 2019
1 parent 868107b commit 191c21f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/imagetransforms/ImageTransform.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function appendExtension($pathOrUrl, $extension): string
{
$path = $this->decomposeUrl($pathOrUrl);
$path_parts = pathinfo($path['path']);
$new_path = $path_parts['filename'] . '.' . $path_parts['extension'] . $extension;
$new_path = ($path_parts['filename'] ?? '') . '.' . ($path_parts['extension'] ?? '') . $extension;
if (!empty($path_parts['dirname']) && $path_parts['dirname'] !== '.') {
$new_path = $path_parts['dirname'] . DIRECTORY_SEPARATOR . $new_path;
$new_path = preg_replace('/([^:])(\/{2,})/', '$1/', $new_path);
Expand Down

0 comments on commit 191c21f

Please sign in to comment.