[PR #5625] [MERGED] fix: make profile and card imports resilient #6852

Closed
opened 2026-10-23 04:14:18 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5625
Author: @SpicyMarinara
Created: 8/29/2026
Status: ✅ Merged
Merged: 8/29/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/5624-profile-import-single-upload


📝 Commits (3)

  • 26036cb fix(import): reuse profile preview uploads
  • 52aac17 fix(import): remove profile and card byte caps
  • b1a4d1c fix(import): close invalid archive streams

📊 Changes

17 files changed (+545 additions, -344 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 e2e/core-flows.e2e.ts (+76 -0)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+23 -4)
📝 packages/client/src/lib/png-parser.ts (+0 -8)
📝 packages/client/src/lib/profile-import-warnings.ts (+17 -3)
📝 packages/client/src/localization/locales/en.json (+3 -0)
📝 packages/server/src/app.ts (+1 -1)
📝 packages/server/src/routes/backup.routes.ts (+181 -147)
📝 packages/server/src/routes/import.routes.ts (+15 -27)
📝 packages/server/src/services/import/marinara.importer.ts (+0 -11)
📝 packages/server/src/services/import/profile-import-assets.ts (+42 -23)
📝 packages/server/src/services/import/st-bulk.importer.ts (+2 -5)
📝 packages/server/src/services/import/st-character.importer.ts (+0 -37)
📝 scripts/regressions/automatic-backup-retention.regression.ts (+3 -6)
📝 scripts/regressions/open-issues.regression.ts (+66 -12)
📝 scripts/regressions/profile-import-asset-security.regression.ts (+36 -54)
📝 scripts/regressions/profile-import-data-security.regression.ts (+78 -6)

📄 Description

Linked issue

Closes #5624

Why this change

  • A large profile ZIP was uploaded once for preview, deleted, then uploaded again after confirmation. On poor Wi-Fi this doubled an hours-long transfer.
  • One unsupported or corrupt asset promoted a per-file validation failure into a whole-profile failure, preventing valid tables and assets from restoring.
  • Fixed archive and metadata byte ceilings blocked legitimate multi-gigabyte profiles and character/persona cards with large image galleries.

What changed

  • Retain each reviewed profile import behind a short-lived, one-time server token and submit only that token after confirmation.
  • Clean staged previews on cancellation, expiry, server shutdown, or import completion.
  • Skip individual invalid or corrupt profile assets with explicit warnings while valid profile data and assets continue restoring.
  • Stream profile ZIP uploads and restored assets through disk, support ZIP64 output, and remove application byte ceilings from profile archives and media.
  • Remove fixed byte ceilings from native character/persona, PNG card, folder card, and CharX imports.
  • Preserve path, image-content, CRC, archive-structure, and privileged-access validation. Imported profile executable content remains quarantined.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • pnpm check
  • Focused profile asset, profile data-security, automatic-backup, and open-issue regression suites
  • Playwright Settings import flow: preview body uploaded once, confirmation body empty, invalid .native warned, valid GIF restored
  • Playwright streamed profile/full-backup archive round-trip
  • Large compressed PNG card metadata regression above the former 5 MB ceiling on both client and server parsers

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] <paths> follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Behavior-only Settings import fix; no layout or styling changed. The permanent Playwright UI regression exercises the real Settings > Imports confirmation flow.

Summary by CodeRabbit

  • New Features

    • Profile imports now preview and scan selected files once, then reuse the preview during confirmation.
    • Invalid individual assets are skipped with clear warnings while valid assets continue importing.
    • Preview sessions are cleaned up when canceled or completed.
  • Improvements

    • Larger profile archives, galleries, metadata, and supported character imports are accepted.
    • Existing path, media, archive, and executable-content safety checks remain enforced.
  • Bug Fixes

    • Import errors now provide consistent feedback, with skipped assets separated from security warnings.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/5625 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 8/29/2026 **Status:** ✅ Merged **Merged:** 8/29/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/5624-profile-import-single-upload` --- ### 📝 Commits (3) - [`26036cb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/26036cb22605cc71675eeed1f7aa659289929bba) fix(import): reuse profile preview uploads - [`52aac17`](https://github.com/Pasta-Devs/Marinara-Engine/commit/52aac17fcd2f7dfad716f84f64bd1ac94fffddb8) fix(import): remove profile and card byte caps - [`b1a4d1c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b1a4d1c43c498cd449d09e55327ab0c78a8ca668) fix(import): close invalid archive streams ### 📊 Changes **17 files changed** (+545 additions, -344 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `e2e/core-flows.e2e.ts` (+76 -0) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+23 -4) 📝 `packages/client/src/lib/png-parser.ts` (+0 -8) 📝 `packages/client/src/lib/profile-import-warnings.ts` (+17 -3) 📝 `packages/client/src/localization/locales/en.json` (+3 -0) 📝 `packages/server/src/app.ts` (+1 -1) 📝 `packages/server/src/routes/backup.routes.ts` (+181 -147) 📝 `packages/server/src/routes/import.routes.ts` (+15 -27) 📝 `packages/server/src/services/import/marinara.importer.ts` (+0 -11) 📝 `packages/server/src/services/import/profile-import-assets.ts` (+42 -23) 📝 `packages/server/src/services/import/st-bulk.importer.ts` (+2 -5) 📝 `packages/server/src/services/import/st-character.importer.ts` (+0 -37) 📝 `scripts/regressions/automatic-backup-retention.regression.ts` (+3 -6) 📝 `scripts/regressions/open-issues.regression.ts` (+66 -12) 📝 `scripts/regressions/profile-import-asset-security.regression.ts` (+36 -54) 📝 `scripts/regressions/profile-import-data-security.regression.ts` (+78 -6) </details> ### 📄 Description ## Linked issue Closes #5624 ## Why this change - A large profile ZIP was uploaded once for preview, deleted, then uploaded again after confirmation. On poor Wi-Fi this doubled an hours-long transfer. - One unsupported or corrupt asset promoted a per-file validation failure into a whole-profile failure, preventing valid tables and assets from restoring. - Fixed archive and metadata byte ceilings blocked legitimate multi-gigabyte profiles and character/persona cards with large image galleries. ## What changed - Retain each reviewed profile import behind a short-lived, one-time server token and submit only that token after confirmation. - Clean staged previews on cancellation, expiry, server shutdown, or import completion. - Skip individual invalid or corrupt profile assets with explicit warnings while valid profile data and assets continue restoring. - Stream profile ZIP uploads and restored assets through disk, support ZIP64 output, and remove application byte ceilings from profile archives and media. - Remove fixed byte ceilings from native character/persona, PNG card, folder card, and CharX imports. - Preserve path, image-content, CRC, archive-structure, and privileged-access validation. Imported profile executable content remains quarantined. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - `pnpm check` - Focused profile asset, profile data-security, automatic-backup, and open-issue regression suites - Playwright Settings import flow: preview body uploaded once, confirmation body empty, invalid `.native` warned, valid GIF restored - Playwright streamed profile/full-backup archive round-trip - Large compressed PNG card metadata regression above the former 5 MB ceiling on both client and server parsers ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n] <paths>` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Behavior-only Settings import fix; no layout or styling changed. The permanent Playwright UI regression exercises the real Settings > Imports confirmation flow. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Profile imports now preview and scan selected files once, then reuse the preview during confirmation. - Invalid individual assets are skipped with clear warnings while valid assets continue importing. - Preview sessions are cleaned up when canceled or completed. - **Improvements** - Larger profile archives, galleries, metadata, and supported character imports are accepted. - Existing path, media, archive, and executable-content safety checks remain enforced. - **Bug Fixes** - Import errors now provide consistent feedback, with skipped assets separated from security warnings. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:14:18 +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#6852
No description provided.