[GH-ISSUE #709] Persona & character native export drops fields and avatar image on round-trip #338

Closed
opened 2026-10-20 17:27:47 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @LukaTheHero on GitHub (May 11, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/709

Originally assigned to: @LukaTheHero on GitHub.

Bug

Exporting a persona using the Marinara Native format and then importing it back loses the persona's profile picture, plus several other fields that are stored in the DB but not round-tripped.

Screenshot of the issue (imported persona showing default avatar):
Image

The same problem exists for characters: exporting a character as Marinara Native and importing it back also strips the avatar image. (Compatible JSON is expected to omit the avatar — this is by design and is not changing.)

Fields lost during persona round-trip

Stripped at export (buildNativePersonaEnvelope / buildCompatiblePersonaExport):

  • avatarPath (and the actual image file is never embedded)

Ignored at import (importPersona in marinara.importer.ts):

  • comment
  • personaStats
  • altDescriptions
  • tags
  • savedStatusOptions
  • avatarCrop (read but not embedded image data)

Compatible JSON import (ImportPersonaModal):

  • Doesn't send nameColor, dialogueColor, boxColor, personaStats, altDescriptions, savedStatusOptions, avatarCrop

Fields lost during character round-trip

Stripped at export (buildNativeCharacterEnvelope):

  • avatarPath (and the actual image file is never embedded into the JSON envelope — only /export-png embeds it)

Ignored at import (importCharacter):

  • Avatar data, since none is currently embedded in the envelope

Proposed fix

For Marinara Native format only (both personas and characters):

  1. Server export: read the avatar file from disk, base64-encode it as a data URL, attach as avatar field on the envelope's data.
  2. Server import: when an embedded avatar is present, validate the image bytes, write to data/avatars/, and set avatarPath on the new row.
  3. For personas, also round-trip the missing DB fields (comment, personaStats, altDescriptions, tags, savedStatusOptions).

Compatible JSON exports stay avatar-less (as expected by spec).

PR

PR being opened by @LukaTheHero shortly.

Files involved

  • packages/server/src/routes/characters.routes.ts — buildNativePersonaEnvelope, buildCompatiblePersonaExport, buildNativeCharacterEnvelope, both export routes
  • packages/server/src/services/import/marinara.importer.ts — importPersona, importCharacter
  • packages/client/src/components/modals/ImportPersonaModal.tsx — compatible JSON path field pass-through (minor)
Originally created by @LukaTheHero on GitHub (May 11, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/709 Originally assigned to: @LukaTheHero on GitHub. ## Bug Exporting a persona using the Marinara Native format and then importing it back loses the persona's profile picture, plus several other fields that are stored in the DB but not round-tripped. **Screenshot of the issue (imported persona showing default avatar):** <img width="383" height="86" alt="Image" src="https://github.com/user-attachments/assets/981747f6-36fd-4092-b79a-9fd55f348c65" /> The same problem exists for **characters**: exporting a character as Marinara Native and importing it back also strips the avatar image. (Compatible JSON is expected to omit the avatar — this is by design and is not changing.) ## Fields lost during persona round-trip **Stripped at export (`buildNativePersonaEnvelope` / `buildCompatiblePersonaExport`):** - `avatarPath` (and the actual image file is never embedded) **Ignored at import (`importPersona` in `marinara.importer.ts`):** - `comment` - `personaStats` - `altDescriptions` - `tags` - `savedStatusOptions` - `avatarCrop` (read but not embedded image data) **Compatible JSON import (`ImportPersonaModal`):** - Doesn't send `nameColor`, `dialogueColor`, `boxColor`, `personaStats`, `altDescriptions`, `savedStatusOptions`, `avatarCrop` ## Fields lost during character round-trip **Stripped at export (`buildNativeCharacterEnvelope`):** - `avatarPath` (and the actual image file is never embedded into the JSON envelope — only `/export-png` embeds it) **Ignored at import (`importCharacter`):** - Avatar data, since none is currently embedded in the envelope ## Proposed fix For Marinara Native format only (both personas and characters): 1. Server export: read the avatar file from disk, base64-encode it as a data URL, attach as `avatar` field on the envelope's `data`. 2. Server import: when an embedded `avatar` is present, validate the image bytes, write to `data/avatars/`, and set `avatarPath` on the new row. 3. For personas, also round-trip the missing DB fields (`comment`, `personaStats`, `altDescriptions`, `tags`, `savedStatusOptions`). Compatible JSON exports stay avatar-less (as expected by spec). ## PR PR being opened by @LukaTheHero shortly. ## Files involved - `packages/server/src/routes/characters.routes.ts` — `buildNativePersonaEnvelope`, `buildCompatiblePersonaExport`, `buildNativeCharacterEnvelope`, both export routes - `packages/server/src/services/import/marinara.importer.ts` — `importPersona`, `importCharacter` - `packages/client/src/components/modals/ImportPersonaModal.tsx` — compatible JSON path field pass-through (minor)
bsakaguchi 2026-10-20 17:27:47 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#338
No description provided.