Preserve PNG uploads as PNG and make image storage format-aware - #20
Preserve PNG uploads as PNG and make image storage format-aware#20langningchen with Copilot wants to merge 2 commits into
Conversation
Co-authored-by: langningchen <81672884+langningchen@users.noreply.github.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
image | 8f5dbca | Commit Preview URL Branch Preview URL |
Aug 22 2026, 12:23 PM |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f5dbca6a3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| headers: corsHeaders, | ||
| }); | ||
| } | ||
| const imageExtension: ImageExtension = imageMatch[1].toLowerCase() === 'png' ? 'png' : 'jpeg'; |
There was a problem hiding this comment.
Update purge workflow for PNG image histories
When this line starts storing PNG uploads as ${imageId}.png, the second cleanup stage stops covering those files: target-repository/scripts/purge-deleted-image-history.sh:26 and :30 still only select deleted *.jpeg paths. The Worker can delete stale PNGs from HEAD, but the documented history-purge workflow will never select their deleted paths, so PNG uploads continue consuming repository history indefinitely; please extend that script to include .png alongside .jpeg.
Useful? React with 👍 / 👎.
| const mimeType = /^data:image\/png;/i.test(dataUrl) ? 'image/png' : 'image/jpeg'; | ||
| resolve(canvas.toDataURL(mimeType, quality)); |
There was a problem hiding this comment.
Commit the rebuilt browser bundle
This source change does not reach clients that use the checked-in Worker assets: wrangler.toml serves ./public, public/index.html loads /main.js, and the current public/main.js still calls toDataURL("image/jpeg", z). In deployments or reviews that serve the committed public directory without regenerating it, PNG uploads larger than 1 MiB are still converted to JPEG before /upload; please rebuild and commit public/main.js or remove the stale checked-in bundle from the served path.
Useful? React with 👍 / 👎.
PNG uploads were being converted to JPEG, which removes alpha transparency. This change keeps PNG assets as
.pngwhile preserving compatibility with existing.jpegimages across read and cleanup paths.Upload format preservation
image/png(instead of forcingimage/jpeg).${imageId}.pngfor PNG,${imageId}.jpegotherwise.Format-aware image serving
.png,.jpeg) for a givenimageId.Content-Typenow reflects the resolved file type (image/pngorimage/jpeg).Retention and deletion compatibility
.pngand.jpegimage objects.imageId.