Skip to content

Commit

Permalink
Fix imagesproxy for image paths without query parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Phu2 committed Dec 10, 2024
1 parent c3d7e95 commit 5104057
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions gatsby/lobid/static/imagesproxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
$positionOfColon = strpos($url,"%");
$url= substr_replace($url,":",$positionOfColon,3);
// restore the query Parameter
$positionOfQueryParameter = strrpos($url,"%3F");
$url= substr_replace($url,"?",$positionOfQueryParameter,3);
// restore the
$positionOfEqual = strrpos($url,"%3D", $positionOfQueryParameter);
$url= substr_replace($url,"=",$positionOfEqual,3);
$positionOfQueryParameter = strrpos($url,"%3F");
if ($positionOfQueryParameter !== false) {
$url= substr_replace($url,"?",$positionOfQueryParameter,3);
// restore the
$positionOfEqual = strrpos($url,"%3D", $positionOfQueryParameter);
$url= substr_replace($url,"=",$positionOfEqual,3);
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
Expand Down

0 comments on commit 5104057

Please sign in to comment.