Repository navigation
Conversation
|
Visit the preview URL for this PR (updated for commit 1082231): https://gcode-preview--pr507-codex-fix-thumbnail-0ca2pu1o.web.app (expires Tue, 03 Nov 2026 09:23:10 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 59bd114ae4847b32c2bba0b68620b9069a3e3531 |
sophiedeziel
approved these changes
Sep 10, 2026
This branch has not been deployed
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.
Problem
PNG thumbnails such as those embedded in
demo/gcodes/screw.gcodedeclareimage/jpegin their data URLs, giving consumers the wrong content type. Fixes #504.Cause
Thumbnail.srchardcodes the JPEG prefix regardless of the embedded image format. Browsers can sniff the payload, masking the mismatch.Fix
Decode only the leading base64 characters and identify PNG, JPEG, or QOI from their magic bytes. Keep the existing JPEG fallback for unknown or malformed data so accessing
srcremains tolerant of incomplete input.Behavior changes
PNG and QOI payloads now declare
image/pngandimage/qoi; JPEG retainsimage/jpeg. The payload and getter signature remain unchanged.Checks
npm run test:coverage: 984 tests pass; 100% statement, branch, function, and line coverage.npm run typeChecknpm run lintnpm run buildbugandparser.Assisted by Codex - GPT-6