Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some media file names break liquid resize_url #15423

Closed
bashuss opened this issue Feb 29, 2024 · 1 comment · Fixed by #16135
Closed

Some media file names break liquid resize_url #15423

bashuss opened this issue Feb 29, 2024 · 1 comment · Fixed by #16135
Labels
Milestone

Comments

@bashuss
Copy link

bashuss commented Feb 29, 2024

Describe the bug

  1. OC Version 1.7
  2. Images in the media library that contain a space (" ") in the name seem to break the resize_url feature.
  3. Renaming the file with "-" instead of " " makes it work again.
  4. The disfunction with " " still delivers an image derived from the original source, but not the requested one. So this may be a problem of accessing the correct cached resized image.

Easy workaround - the problem is, that you need to find out the reason, before you can fix it. Took me while.

To Reproduce

Steps to reproduce the behavior:

  1. upload a file "anyname 01.jpg"
  2. access it by a <picture>-tag giving several different resized versions of the url by liquid | asset_url | resize_url - in my case this code:
{% assign imgPath = "anyname 01.jpg" %}
<picture>
  <source media="(min-width:1200px)" srcset="{{ imgPath | asset_url  | resize_url: width:1200, height:1200, mode:MAX }}" />
  <source media="(min-width:992px)" srcset="{{ imgPath | asset_url  | resize_url: width:992, height:992, mode:MAX }}" />
  <source media="(min-width:768px)" srcset="{{ imgPath | asset_url  |  resize_url: width:768, height:768, mode:MAX }}" />
  <source media="(min-width:576px)" srcset="{{ imgPath | asset_url  | resize_url: width:576, height:576, mode:MAX }}" />
  <img src="{{ imgPath | asset_url  | resize_url: width:420, height:420, mode:MAX }}" alt="myImage" />
</picture>
  1. Resize the window, so the different sources of are shown.
  2. In my case, it was always the same size - it was the 420px size.
  3. Changing the filename to "anytime-01.jpg" in media library and code fixed the behavior

Expected behavior

All file names accepted in the media library must work with resize url.

@sebastienros
Copy link
Member

Maybe some url encoding is necessary in one of these filters

@sebastienros sebastienros added this to the 1.x milestone Mar 7, 2024
@MikeAlhayek MikeAlhayek modified the milestones: 2.x, 2.0 Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants