[PR #5260] [MERGED] Portable ZIP Export Format #6458

Closed
opened 2026-02-05 10:32:50 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/5260
Author: @ssddanbrown
Created: 10/13/2024
Status: Merged
Merged: 12/1/2024
Merged by: @ssddanbrown

Base: developmentHead: portazips


📝 Commits (10+)

  • e088d09 ZIP Export: Started defining format
  • 1930af9 ZIP Export: Started types in format doc
  • 42bd07d ZIP Export: Continued expanding format doc types
  • 42b9700 ZIP Exports: Finished up format doc, move files, started builder
  • bf0262d Testing: Split export tests into multiple files
  • 21ccfa9 ZIP Export: Expanded page & added base attachment handling
  • 7c39dd5 ZIP Export: Started building link/ref handling
  • 06ffd8e Zip Exports: Added attachment/image link resolving & JSON null handling
  • 4fb4fe0 ZIP Exports: Added working image handling/inclusion
  • f732ef0 ZIP Exports: Reorganised files, added page md parsing

📊 Changes

84 files changed (+5269 additions, -717 deletions)

View changed files

📝 app/Activity/ActivityType.php (+4 -0)
📝 app/Entities/Models/Chapter.php (+1 -0)
📝 app/Entities/Repos/PageRepo.php (+12 -1)
📝 app/Entities/Tools/Cloner.php (+6 -11)
app/Exceptions/ZipExportException.php (+7 -0)
app/Exceptions/ZipImportException.php (+13 -0)
app/Exceptions/ZipValidationException.php (+12 -0)
📝 app/Exports/Controllers/BookExportApiController.php (+2 -2)
📝 app/Exports/Controllers/BookExportController.php (+16 -2)
📝 app/Exports/Controllers/ChapterExportApiController.php (+2 -2)
📝 app/Exports/Controllers/ChapterExportController.php (+15 -2)
app/Exports/Controllers/ImportController.php (+110 -0)
📝 app/Exports/Controllers/PageExportApiController.php (+2 -2)
📝 app/Exports/Controllers/PageExportController.php (+15 -2)
📝 app/Exports/ExportFormatter.php (+3 -1)
app/Exports/Import.php (+66 -0)
app/Exports/ImportRepo.php (+137 -0)
📝 app/Exports/PdfGenerator.php (+2 -2)
app/Exports/ZipExports/Models/ZipExportAttachment.php (+66 -0)
app/Exports/ZipExports/Models/ZipExportBook.php (+118 -0)

...and 64 more files

📄 Description

Todo

  • Finish up format document
    • Add consideration in regard to HTML content (security in usage [csp] and featureset compatibility).
  • ZIP Build Logic
    • Testing
  • Export UI additions
  • Export Endpoints
    • Testing
  • Import role permission
    • Test view/route access control (ensure permission required)
  • Import UI
    • Disable button and show loading on import
  • Import Validator Logic
    • Validate no duplicate ids across types.
    • Display of validation results
    • Extract text to translations
  • Import logic
    • Test file handling & DB roll-back on import error.
    • Image extension handling
    • Test main import handling logic
  • Bring text into translations
  • Other testing
    • Test whole process with external (s3) storage
    • Deep test of cross content references.
  • New activities?
  • Replace id_ciphertext property with newly generated internal ID (setting stored via migration?).
    • The id_ciphertext solution should be fine but better to be completely safe and not risk things, in the event there's some configuration or nuance that could affect things here.

Notes

Originally planned to add API endpoints as part of this, but think it's better to delay in case further changes/development need to be made.

Doc Updates

  • Requirements change - ZIP extension now required.
  • Probably worth a documentation page to cover details. Refer to format docs for advanced users.

🔄 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/BookStackApp/BookStack/pull/5260 **Author:** [@ssddanbrown](https://github.com/ssddanbrown) **Created:** 10/13/2024 **Status:** ✅ Merged **Merged:** 12/1/2024 **Merged by:** [@ssddanbrown](https://github.com/ssddanbrown) **Base:** `development` ← **Head:** `portazips` --- ### 📝 Commits (10+) - [`e088d09`](https://github.com/BookStackApp/BookStack/commit/e088d09e4705a4348444aaa8ec1b49a07128e063) ZIP Export: Started defining format - [`1930af9`](https://github.com/BookStackApp/BookStack/commit/1930af91cea9ab830562933f738b1c9d151b0640) ZIP Export: Started types in format doc - [`42bd07d`](https://github.com/BookStackApp/BookStack/commit/42bd07d73325ed468bae2658ba130314f6fe4a21) ZIP Export: Continued expanding format doc types - [`42b9700`](https://github.com/BookStackApp/BookStack/commit/42b9700673e7b2e5a04c9f888a05d98261ed36e3) ZIP Exports: Finished up format doc, move files, started builder - [`bf0262d`](https://github.com/BookStackApp/BookStack/commit/bf0262d7d178b494e256ff5164a8d75195cdc231) Testing: Split export tests into multiple files - [`21ccfa9`](https://github.com/BookStackApp/BookStack/commit/21ccfa97ddfe6309ff735aafbc8138cf34782563) ZIP Export: Expanded page & added base attachment handling - [`7c39dd5`](https://github.com/BookStackApp/BookStack/commit/7c39dd5cba7b72184adb96a8236ca1a3c99f03e3) ZIP Export: Started building link/ref handling - [`06ffd8e`](https://github.com/BookStackApp/BookStack/commit/06ffd8ee721a74dea9c584002b2793cc68c873a0) Zip Exports: Added attachment/image link resolving & JSON null handling - [`4fb4fe0`](https://github.com/BookStackApp/BookStack/commit/4fb4fe0931d220ffb9d7e173388351047b665f4c) ZIP Exports: Added working image handling/inclusion - [`f732ef0`](https://github.com/BookStackApp/BookStack/commit/f732ef05d5b60a48ce3b42e05155e9e91d92d927) ZIP Exports: Reorganised files, added page md parsing ### 📊 Changes **84 files changed** (+5269 additions, -717 deletions) <details> <summary>View changed files</summary> 📝 `app/Activity/ActivityType.php` (+4 -0) 📝 `app/Entities/Models/Chapter.php` (+1 -0) 📝 `app/Entities/Repos/PageRepo.php` (+12 -1) 📝 `app/Entities/Tools/Cloner.php` (+6 -11) ➕ `app/Exceptions/ZipExportException.php` (+7 -0) ➕ `app/Exceptions/ZipImportException.php` (+13 -0) ➕ `app/Exceptions/ZipValidationException.php` (+12 -0) 📝 `app/Exports/Controllers/BookExportApiController.php` (+2 -2) 📝 `app/Exports/Controllers/BookExportController.php` (+16 -2) 📝 `app/Exports/Controllers/ChapterExportApiController.php` (+2 -2) 📝 `app/Exports/Controllers/ChapterExportController.php` (+15 -2) ➕ `app/Exports/Controllers/ImportController.php` (+110 -0) 📝 `app/Exports/Controllers/PageExportApiController.php` (+2 -2) 📝 `app/Exports/Controllers/PageExportController.php` (+15 -2) 📝 `app/Exports/ExportFormatter.php` (+3 -1) ➕ `app/Exports/Import.php` (+66 -0) ➕ `app/Exports/ImportRepo.php` (+137 -0) 📝 `app/Exports/PdfGenerator.php` (+2 -2) ➕ `app/Exports/ZipExports/Models/ZipExportAttachment.php` (+66 -0) ➕ `app/Exports/ZipExports/Models/ZipExportBook.php` (+118 -0) _...and 64 more files_ </details> ### 📄 Description ### Todo - [x] Finish up format document - [x] Add consideration in regard to HTML content (security in usage [csp] and featureset compatibility). - [x] ZIP Build Logic - [x] Testing - [x] Export UI additions - [x] Export Endpoints - [x] Testing - [x] Import role permission - [x] Test view/route access control (ensure permission required) - [x] Import UI - [x] Disable button and show loading on import - [x] Import Validator Logic - [x] Validate no duplicate ids across types. - [x] Display of validation results - [x] Extract text to translations - [x] Import logic - [x] Test file handling & DB roll-back on import error. - [x] Image extension handling - [x] Test main import handling logic - [x] Bring text into translations - [x] Other testing - [x] Test whole process with external (s3) storage - [x] Deep test of cross content references. - [x] New activities? - [x] Replace `id_ciphertext` property with newly generated internal ID (setting stored via migration?). - The id_ciphertext solution should be fine but better to be completely safe and not risk things, in the event there's some configuration or nuance that could affect things here. ### Notes Originally planned to add API endpoints as part of this, but think it's better to delay in case further changes/development need to be made. ### Doc Updates - **Requirements change** - ZIP extension now required. - Probably worth a documentation page to cover details. Refer to format docs for advanced users. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:32:50 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6458