Repository navigation
Emoji, server and group icons, and webhook pictures are decoded by the worker, not the server (GRYT-1664) - #278
Merged
Conversation
…e worker, not the server (GRYT-1664) Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The last places the server decoded a picture itself, with sharp in its own process. They were found by GPT's #269, which this replaces. Each now goes through the image worker's jail when the worker can clear quarantine. Without one (the Windows zip, a source install) they keep today's path.
processEmojiToOptimizedImage. When the worker is there, it hands the bytes over withreencodeThroughWorker, waits for the worker's copy (two minutes at most), returns it, and drops the temporary file. The caller stores it under its own key as before. A refusal fails the upload with the existing "Failed to process image."MAX_ICON_FRAMES, since the frames can't be counted without decoding./group-icon,/webhook-avatar): quarantined like avatars. The pointer is set by the caller as before, and the file is only served once the worker has written it out.validateImagehere any more. Card pictures are stored in quarantine, and the loader push from Every chat picture and video goes through the worker, and readers see a loader until it has (GRYT-1669) #277 tells readers when they're ready. The webhook's avatar goes throughquarantineUpload.imageHeaderSizereads PNG, GIF, JPEG and WebP sizes from the header bytes. sharp is no longer used on a remote picture at all. These are layout hints only.Tested live with server and worker in Docker: a GIF emoji came out 171×128 animated WebP, a PNG emoji AVIF, the server icon and a group picture 256×256 AVIF, all in the worker's log. HTML named
.pngas an emoji was refused in the jail and the upload answered 400. Unit tests cover the group picture through quarantine, the emoji round trip against a stand-in worker (only its copy comes back, no temporary file left), and the header reader for each format. Full suite: 1982 pass.What to look at:
reencodeThroughWorkerwrites a temporaryfilesrow, which is deleted afterwards whatever happens.Closes #269. Not review-required (no db, auth, middleware or storage changes), but it's the security path, so read it if you can.
🤖 Generated with Claude Code