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 joshtrichards added this to the Nextcloud 35 milestone Jun 25, 2026
@joshtrichards joshtrichards requested a review from a team as a code owner June 25, 2026 16:10
@joshtrichards joshtrichards requested review from ArtificialOwl, come-nc, leftybournes and salmart-dev and removed request for a team June 25, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant