mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #8423] [MERGED] fix(image): decode a data URL in b64_json and type base64 results by their bytes #8591
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#8591
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/8423
Author: @SpicyMarinara
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/xai-image-data-url📝 Commits (1)
b4c17c5fix(image): decode a data URL in b64_json and type base64 results by their bytes📊 Changes
2 files changed (+71 additions, -3 deletions)
View changed files
📝
packages/server/src/services/image/image-generation.ts(+14 -3)➕
scripts/regressions/image-base64-data-url.regression.ts(+57 -0)📄 Description
Linked issue
Closes #8422
Why this change
b64_jsonas a wholedata:image/jpeg;base64,…URL.generateXAIpassed that on as the base64 of a PNG, so callers builtdata:image/png;base64,data:image/jpeg;base64,…and decoded garbage.What changed
image-generation.ts: a newimageResultFromBase64Fielddecodes a data URL in ab64_json-style field with the existingdecodeImageDataUrl(as NanoGPT's reader already did), and types bare base64 by its bytes withdetectImageMimeType, falling back to PNG only when they match no known format.image/pngingenerateXAI, the shared OpenAI-compatible reader (readOpenAIImageResult) and Together AI.scripts/regressions/image-base64-data-url.regression.ts: a local fake provider answers a data URL, bare JPEG base64 and bare PNG base64 for xAI, OpenAI and Together AI. It fails on the old code (xai: a data URL keeps its type: actualimage/png).Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Agent-side checks:
pnpm checkexited 0. Its one lint warning is in an untouched client file.image-custom-parameters,image-edit-reference,generated-image-format,gpt-image-2-5,fal-image,codex-chatgpt-imageandimage-dimension-limit.Please verify by hand:
grok-imagine-image-2.0), that an avatar generated with no source image saves and shows as a JPEG.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)
Not a UI change.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.