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

If null happens to coincide with one of the image widths or formats passed in, duplicate copies are generated #124

Closed
AleksandrHovhannisyan opened this issue Aug 31, 2021 · 2 comments · Fixed by #125
Milestone

Comments

@AleksandrHovhannisyan
Copy link
Contributor

AleksandrHovhannisyan commented Aug 31, 2021

Steps to reproduce:

  1. Invoke the image plugin with the following source image (400px wide): https://images.unsplash.com/photo-1591160690555-5debfba289f0?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=400&q=80
  2. Specify [null, 400] for the widths option.
  3. Observe that the output JSON contains two 400-width images in the array.

This causes an issue on my site where an image is listed twice in the markup:

image

Also reproducible if:

  1. You replace null with 400: [400, 400].
  2. You pass in duplicate formats, like [null, 'png'] when the original format is png.

Expected behavior: The final widths/formats passed to the plugin should be unique. If a width/format happens to coincide with the source image width/format (null), only one copy should be returned.

Would be happy to contribute a PR (assuming this is in fact a bug and not the intended behavior)

@AleksandrHovhannisyan AleksandrHovhannisyan changed the title If null happens to coincide with one of the image widths passed in, two copies are generated If null happens to coincide with one of the image widths or formats passed in, duplicate copies are generated Aug 31, 2021
@AleksandrHovhannisyan
Copy link
Contributor Author

Bump, just wanna make sure this is at least on someone's radar 😄

@zachleat
Copy link
Member

zachleat commented Sep 8, 2021

Appreciate this one, thank you!

@zachleat zachleat added this to the v1.0.0 milestone Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants