img_url / image_url inconsistency with broken image urls
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
A product without an image using the img_url filter:
{{ product | img_url }}
Outputs a valid image URL:
//cdn.shopify.com/shopifycloud/shopify/assets/no-image-100-c91dd4bdb56513f2cbf4fc15436ca35e9d4ecd014546c8d421b1aece861dfecf_small.gif
A product without an image using the image_url filter:
{{ product | image_url }}
Outputs the follow error:
[Liquid error (snippets/image line 8): invalid url input](http://127.0.0.1:9292/products/test)
[test](http://127.0.0.1:9292/products/test)
Nobody wants to see an error with a line reference to the store's source code on a production store due to a bad image link. I can't think of any scenario where this behaviour would be preferable.
This also breaks any proceeding image_tag filter.
Is this a bug?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the implementations and tests for the img_url and image_url filters, then reproduce both cases with a product that has no image. Done means image_url no longer emits invalid-url or source-line errors and remains compatible with image_tag, with regression coverage matching img_url.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100