Skip to content

fix(image): honor file path when saving WebP images - #61598

Open
joshtrichards wants to merge 1 commit into
masterfrom
jtr/fix-Image-WebP-output
Open

fix(image): honor file path when saving WebP images#61598
joshtrichards wants to merge 1 commit into
masterfrom
jtr/fix-Image-WebP-output

Conversation

@joshtrichards

@joshtrichards joshtrichards commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary

Fix WebP image saving by passing the requested destination path to imagewebp().

Previously, the WebP branch in OC\Image::_output() passed null as the target path, which could write the image to output instead of saving it to the requested file.

Noticed this in Image::_output() while perusing the code. While it's almost certainly a bug that breaks save(), admittedly I also can't find any callers of save()... but it is part of our public API so at least correcting this as long as the function still exists...

/**
* Saves the image.
*
* @param string $filePath
* @param string $mimeType
* @since 8.1.0
*/
public function save(?string $filePath = null, ?string $mimeType = null): bool;

Tests pass for save() because it only impacts WebP image format specifically, which isn't a format specifically covered.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI
Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards

Copy link
Copy Markdown
Member Author

May fold into #61637 to avoid rebasing/conflicts

This was referenced Aug 12, 2026
@nextcloud-bot nextcloud-bot mentioned this pull request Aug 20, 2026
@skjnldsv skjnldsv mentioned this pull request Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants