mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6060] [MERGED] fix(chat): keep the aspect ratio of EXIF-rotated image attachments #7045
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7045
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6060
Author: @Romuromylus
Created: 9/11/2026
Status: ✅ Merged
Merged: 9/11/2026
Merged by: @Romuromylus
Base:
staging← Head:fix/attachment-exif-orientation📝 Commits (1)
a5fb55ffix(chat): keep the aspect ratio of EXIF-rotated image attachments📊 Changes
3 files changed (+173 additions, -3 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
packages/client/src/lib/chat-attachment-images.ts(+60 -3)➕
scripts/regressions/chat-attachment-exif-orientation.regression.ts(+112 -0)📄 Description
Linked issue
Closes #6053
Why this change
createImageBitmapapplies the EXIF orientation before it resizes. A phone photo stored as 3000x2000 with orientation 6 decodes as a 2000x3000 portrait and was then forced into a 1536x1024 bitmap, so the compressed JPEG itself carried the wrong aspect ratio. Every laterobject-fitwas already correct; the pixels were wrong.resizeWidth: 1536, resizeHeight: 1024call yields the portrait content squashed into a landscape bitmap.What changed
chat-attachment-images.tsnow also reads the ExifOrientationtag (APP1, both byte orders, bounds-checked) and swaps the frame width and height for the transposing orientations 5 to 8, so the resize hint matches the bitmap the browser will produce.createImageBitmapcalls pinimageOrientation: "from-image", so the behaviour does not depend on a browser default. This is belt and braces; the dimension swap is the fix.scripts/regressions/chat-attachment-exif-orientation.regression.tscovers orientations 1, 3, 5 to 8 in both byte orders, a non-Exif APP1 ahead of the Exif segment, a truncated Exif segment, and the untouched PNG path.Game Mode is not affected: its composer stores the raw file without running the compressor.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
pnpm --filter @marinara-engine/client lintgreen (one pre-existing unrelated warning);node scripts/run-regressions.mjs --filter chat-attachment-exif-orientationpasses.pnpm checkgreen locally.resizeWidth: 1536, resizeHeight: 1024call produced the portrait content squashed into a landscape bitmap. After deploying this branch: attaching the same file produces a 1024x1536 JPEG payload, portrait preserved.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)UI evidence (if applicable)
Payload dimensions on the production deploy for the same EXIF orientation 6 photo:
Summary by CodeRabbit
Bug Fixes
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.