timber / timber/timber

[BUG] `towebp` filter always returns new filename, even when conversion was unsuccessful

Open
#2,875 1 comment 0 reactions 0 assignees View on GitHub

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
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.