statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

Glide outputs wrong URL when image manipulation cached #2478

Open aerni opened 4 years ago

aerni commented 4 years ago

Describe the bug When image_manipulation_cached: true the output Glide URL includes /./. This is leading to potential errors, e.g. with meta tags like og:image. Facebook doesn't like the /./ in the URL and doesn't show the image.

http://lichtundsalz.test/images/containers/main/./social_share_image.jpg/03577ed57608566f6ffe3e38ac94ffa8.jpg

To Reproduce I tried to reproduce this bug myself. But couldn't reproduce it on other installations with the same version.

Expected behavior Glide URL without /./

Potential Fix I quickly fixed this issue by adding the following code to line: 154 in GlideTags.php

if (Str::contains($url, '/./')) {
  $url = str_replace('/./', '/', $url);
}

There might be a better way and place to fix this?

Environment details (please complete the following information):