[BUG] `towebp` filter always returns new filename, even when conversion was unsuccessful
Open
Nobody has claimed this yet.
2.x Future
bug
Image(Helper)
- Dominant language
- PHP
- Stars
- 5.7k
- Forks
- 503
- Avg merge
- 2h 19m
- Merged PRs (30d)
- 1
Description
Expected Behavior
When using the towebp filter, the original filename should be returned if the file could not be converted.
Actual behavior
The filename is returned with towebp after it.
Steps to reproduce behavior
{{ file | towebp }}
If file is white-castle.tif, this still returns white-castle.webp.
Notes
- I just submitted a PR that also touches on the
towebpfilter, but that shouldn't affect solving this issue: https://github.com/timber/timber/pull/2876 - If this ticket is approved, I think it should be added to https://github.com/timber/timber/issues/2866
What version of Timber are you using?
2.0.0
What version of WordPress are you using?
No response
What version of PHP are you using?
No response
How did you install Timber?
None
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 by locating the towebp filter implementation and the conversion-failure path. Reproduce the issue with the white-castle.tif example and verify that an unsuccessful conversion returns the original filename instead of a .webp filename.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100