workarea-commerce / workarea

Workarea is an enterprise-grade Ruby on Rails commerce platform
https://www.workarea.com
Other
327 stars 66 forks source link

Fix Editing Product Images in Admin #509

Closed tubbo closed 4 years ago

tubbo commented 4 years ago

When an image does not include an option, the edit page errors because #parameterize cannot be called on @image.option since that is returning nil. Additionally, the line of code in which this is called is meant to set an ID attribute on the element for which an image is rendered. There doesn't seem to be anything in our codebase that uses this, and furthermore since there's no validation for unique options per set of product images, this could cause a duplicate ID error in certain scenarios. To resolve this, the ID attribute has been removed from this <img> tag.