Skip to content

Fix webp upload and previews#10738

Merged
abnegate merged 9 commits into1.8.xfrom
fix-webp-library
Nov 13, 2025
Merged

Fix webp upload and previews#10738
abnegate merged 9 commits into1.8.xfrom
fix-webp-library

Conversation

@stnguyen90
Copy link
Copy Markdown
Contributor

@stnguyen90 stnguyen90 commented Oct 30, 2025

What does this PR do?

Upgrade base image to version 0.10.5 ensuring libwebp is installed in the base image when imagemagick is installed so that imagemagick works with webp.

Fixes #10699

Test Plan

  • added test cases
  • manually tested and confirmed webp images worked

Related PRs and Issues

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

Ensure libwebp is installed in the base image when imagemagick is installed so that imagemagick works with webp.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 30, 2025

📝 Walkthrough

Walkthrough

This PR updates the Docker base image from appwrite/base:0.10.4 to appwrite/base:0.10.5, removes explicit libwebp package installation, and extends e2e storage tests to validate WEBP file handling. The testCreateBucketFile method now returns webpFileId, a new testFilePreview method is introduced to verify preview generation with image/webp content-type, and testListBucketFiles pagination assertion is adjusted. The changes introduce WEBP file upload, preview validation, and content verification into the test workflow.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Duplicate testFilePreview method definition: The summary indicates testFilePreview appears twice in the file, which may indicate a copy-paste error or unintended duplication requiring clarification
  • Test data chaining with webpFileId: Verify that webpFileId is correctly propagated through dependent test methods and used appropriately in testFilePreview
  • Pagination assertion change: Confirm the change in testListBucketFiles from expecting zero files to one file is intentional and correct for the test scenario
  • Base image version bump: While the Dockerfile change is minimal, verify that appwrite/base:0.10.5 includes necessary dependencies for WEBP preview functionality

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix webp upload and previews' directly summarizes the main objective of the PR: resolving WEBP image preview functionality.
Description check ✅ Passed The description explains the motivation (upgrading base image to 0.10.5 to ensure libwebp is installed), references the linked issue (#10699), and includes a test plan.
Linked Issues check ✅ Passed The PR addresses issue #10699 by upgrading the base image to 0.10.5 to ensure libwebp is available for ImageMagick WEBP support, and adds test cases for WEBP upload and preview functionality.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing WEBP preview support: base image upgrade, libwebp removal from Dockerfile (as it's in base 0.10.5), and test cases for WEBP workflows.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-webp-library

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6072675 and 4f1940a.

📒 Files selected for processing (2)
  • Dockerfile (1 hunks)
  • tests/e2e/Services/Storage/StorageBase.php (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/e2e/Services/Storage/StorageBase.php (1)
tests/e2e/Client.php (1)
  • Client (8-342)
🔇 Additional comments (6)
Dockerfile (1)

15-15: LGTM! Base image upgrade addresses the WEBP support issue.

The upgrade to appwrite/base:0.10.5 resolves the missing libwebp delegate error by ensuring libwebp is installed when ImageMagick is built, enabling WEBP image processing.

tests/e2e/Services/Storage/StorageBase.php (5)

33-33: LGTM! Enabling WEBP uploads for testing.

Adding 'webp' to the allowed extensions enables the test suite to validate WEBP file handling, which is the core objective of this PR.


298-298: LGTM! Return value extended for test chaining.

Adding webpFileId to the return array enables dependent tests to access the uploaded WEBP file, supporting comprehensive end-to-end validation.


451-451: LGTM! Pagination assertion correctly updated.

The assertion correctly reflects that bucketId now contains 2 files (logo.png and image.webp). With offset(1), one file is skipped and one remains, so expecting 1 is correct.


904-927: LGTM! Preview conversion test validates WEBP output.

This test addresses the second requirement from the PR objectives by confirming that previewing a PNG file with output=webp successfully returns a WEBP-formatted image with the correct content-type header.


266-298: LGTM! Comprehensive WEBP upload and view validation.

This test addresses the first requirement from the PR objectives by uploading a WEBP image and verifying both the upload metadata and the view endpoint work correctly. The test resource file has been verified to exist at tests/resources/image.webp.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 30, 2025

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
libxml2 2.13.8-r0 CVE-2025-49794 CRITICAL
libxml2 2.13.8-r0 CVE-2025-49796 CRITICAL
libxml2 2.13.8-r0 CVE-2025-49795 HIGH
libxml2 2.13.8-r0 CVE-2025-6021 HIGH
github.com/containerd/containerd/v2 v2.0.2 CVE-2024-25621 HIGH
golang.org/x/crypto v0.31.0 CVE-2025-22869 HIGH
golang.org/x/oauth2 v0.24.0 CVE-2025-22868 HIGH
stdlib 1.22.10 CVE-2025-47907 HIGH
stdlib 1.22.10 CVE-2025-47912 HIGH
stdlib 1.22.10 CVE-2025-58183 HIGH
stdlib 1.22.10 CVE-2025-58186 HIGH
stdlib 1.22.10 CVE-2025-58187 HIGH
stdlib 1.22.10 CVE-2025-58188 HIGH
stdlib 1.22.10 CVE-2025-61724 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

@stnguyen90
Copy link
Copy Markdown
Contributor Author

@copilot add 2 test cases in https://github.com/appwrite/appwrite/blob/main/tests/e2e/Services/Storage/StorageBase.php:

  1. upload a webp image and ensure viewing it works
  2. previewing a non-webp image successfully returns a webp image (as described by response header)

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 30, 2025

@stnguyen90 I've opened a new pull request, #10739, to work on those changes. Once the pull request is ready, I'll request review from you.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 30, 2025

✨ Benchmark results

  • Requests per second: 1,148
  • Requests with 200 status code: 206,633
  • P99 latency: 0.169161212

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 1,148 1,144
200 206,633 205,951
P99 0.169161212 0.181062858

@stnguyen90 stnguyen90 linked an issue Nov 3, 2025 that may be closed by this pull request
2 tasks
@stnguyen90 stnguyen90 marked this pull request as ready for review November 6, 2025 23:07
Add test coverage for webp upload and preview functionality
@abnegate abnegate merged commit b0a0454 into 1.8.x Nov 13, 2025
42 checks passed
@abnegate abnegate deleted the fix-webp-library branch November 13, 2025 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WEBP images preview not working in 1.8.0

4 participants