Skip to content

Support AVIF and WebP uploads and fix client-side AVIF image conversion - #12

Merged
kiran-brahma merged 1 commit into
mainfrom
fix/avif-webp-image-conversion
Aug 14, 2026
Merged

kiran-brahma merged 1 commit into
mainfrom
fix/avif-webp-image-conversion

Conversation

@kiran-brahma

Copy link
Copy Markdown
Owner

Summary of changes

  1. Enable AVIF and WebP upload: Added avif and webp formats to ENCLOSURE_CATEGORIES_DICT[ENCLOSURE_CATEGORIES.IMAGE].fileTypes in src/shared/Constants.ts and updated fileTypes in AdminImageUploaderApp.
  2. Fix client-side AVIF conversion: Replaced canvas.toBlob('image/avif') (which is unsupported by browser canvas implementations and falls back to PNG) with @jsquash/avif (WebAssembly AVIF encoder) in convertImageToAvif.
  3. Pipeline integration: Updated Requests.upload and AdminImageUploaderApp to ensure converted and native AVIF images are saved with .avif extensions and image/avif MIME types.
  4. Unit test updates: Updated tests/unit/client/image-upload-utils.test.ts to mock and verify @jsquash/avif encoding and fallback paths.

Validation

  • git diff --check: Clean (0 whitespace/formatting issues).
  • yarn typecheck: Clean (Astro diagnostics across 486 files passed with 0 errors).
  • yarn lint:openapi: Passed.
  • yarn cli:check: CLI workspace check passed.
  • yarn theme-kit:test: All theme kit tests passed.
  • yarn test: 102 unit test files (627 tests) and 17 worker test files (146 tests) all passed (773 total tests).
  • yarn build: Production build verified with WebAssembly assets bundled into dist/client/_astro/.

Switches from browser-native `canvas.toBlob` to `@jsquash/avif` for more reliable client-side image conversion. Updates image upload utilities, admin uploader, and corresponding unit tests to support this change and expand supported file types.
@kiran-brahma
kiran-brahma merged commit 722c84f into main Aug 14, 2026
1 of 2 checks passed
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.

1 participant