servdhost / craft-asset-storage

MIT License
10 stars 1 forks source link

`purgeUrls()` fails on index URL #77

Closed raray closed 8 months ago

raray commented 8 months ago

The code in master does not match what I see installed with version 3.5.10 in composer so I'm not sure how to link to the line. What I see for lines 19-21 in craft/vendor/servd/craft-asset-storage/src/StaticCache/Ledge.php is this:

foreach ($urls as $url) {
    $urlParts = parse_url($url);
    if($urlParts['path'] == '' || $urlParts['path'] == '/') {

That if statement will error if the URL passed has no path, such as https://mysite.com since path will not be set as an index. The line should be:

if(empty($urlParts['path']) || $urlParts['path'] == '/') {
mattgrayisok commented 8 months ago

Just released an update to fix this for all Craft versions 👍