Repository navigation
fix(feedback): sanitize screenshot metadata, compress captures, and fall back without screenshot - #1970
Merged
Conversation
…all back without screenshot
callumalpass
marked this pull request as ready for review
November 26, 2026 21:54
callumalpass
enabled auto-merge
November 26, 2026 21:54
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.
Summary
Fixes feedback submission failures (
The screenshot is invalid or too large.) when sending screenshots captured or marked up on high-DPI displays or browsers that emit standard image metadata chunks/segments.Root cause
eXIf,iTXt,tEXt, orzTXtchunks and any JPEG containingAPP1(EXIF/XMP),APP2(ICC color profile),APP13(IPTC), orCOMsegments. macOS/WebKit and high-DPI canvas exports legitimately include metadata chunks and Display P3 ICC profiles.screenshotFromCanvasonly encoded PNG at full canvas resolution without compressing or downscaling to fit the 3 MB attachment limit,FeedbackMarkupalways re-encoded as PNG even for JPEG sources, andreadFeedbackScreenshotrejected uploads above 3 MB upfront instead of scaling them down.400 invalid_screenshotor413 payload_too_large) blocked the feedback message from being delivered.Changes
services/feedback/src/index.ts:eXIf,iTXt,tEXt,zTXt,iDOT) and JPEG EXIF/IPTC/comment segments (0xe1,0xed,0xfe) instead of rejecting otherwise valid images; preserve JPEG ICC color profiles (0xe2) and require PNGIDAT.invalid_screenshot(rather thaninvalid_field) whencontent_base64exceeds the base64 length cap.packages/app-ui/src/feedback-data.ts,FeedbackMarkup.tsx,Feedback.tsx:screenshot.media_typewhen saving markup inFeedbackMarkup.invalid_screenshot,payload_too_large, HTTP413) and automatically resend the feedback text without the screenshot (reusing the unspent Turnstile token because server validation runs before Turnstile verification), informing the user clearly.@mdbase-dev/uilocale catalogues (en,de,es,fr,it,ja,ko,pt,ru,zh).services/feedback/src/index.test.ts).@mdbase-dev/uitests for metadata stripping, downscaled JPEG fallback, and screenshot error classification (packages/app-ui/src/feedback.test.ts).invalid_screenshot(apps/portal/src/FeedbackPage.test.tsx).changelog.d/fix-feedback-screenshot-validation.md.Verification
rpnpm run i18n:checkrpnpm run check:changelogrpnpm run check:architecturerpnpm run build:packagesrpnpm --filter @mdbase/feedback-worker run typecheck && testrpnpm --filter @mdbase-dev/ui run typecheck && test src/feedback.test.tsrpnpm --filter @mdbase/connect-portal run typecheck && test src/FeedbackPage.test.tsx