v2-hub icon indicating copy to clipboard operation
v2-hub copied to clipboard

Glide outputs wrong URL when image manipulation cached

Open aerni opened this issue 5 years ago • 0 comments

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):

  • Statamic Version 2.11.16
  • Fresh Install
  • OS: macOS 10.14.6 or Linux Server
  • Browser: Chrome
  • Web Server: Valet or Apache
  • PHP Version: 7.3
  • Addons installed: SEO Pro

aerni avatar Jan 08 '20 14:01 aerni