Skip to content

API /export/zip Endpoint Returns HTML Instead of Valid ZIP (BookStack v25.02.2) #5700

@southeasterntech

Description

@southeasterntech

Describe the Bug

Description:

When using the BookStack API to export a book using the /export/zip endpoint, the response returns an .html document instead of a valid .zip archive. Attempting to unzip the resulting file produces the following error:

End-of-central-directory signature not found.
Either this file is not a zipfile, or it constitutes one disk of a multi-part archive.
Inspecting the file contents confirms it is an HTML page (starting with ) rather than a ZIP archive.

Steps to Reproduce

Steps to Reproduce:

Generate a valid API token with full access.

Run the following curl command:

bash

curl -L -H "Authorization: Token <YOUR_API_ID>:<YOUR_API_SECRET>"
https://your.bookstack.url/api/books/{book_id}/export/zip
-o bookstack-portable.zip
Attempt to unzip:

bash

unzip -l bookstack-portable.zip
Expected Behavior:
A valid .zip archive containing a portable export of the book.

Expected Behaviour

Zip file returned

Screenshots or Additional Context

Actual Behavior:
An HTML document is returned instead of a .zip file.

System Info:

BookStack Version: v25.05.2

PHP Version: php8.3.19

OS: Ubuntu 22.04 LTS

Reverse Proxy in use: No

-Can reproduce on local machine, with loopback 127.0.0.1 as well... so network not a factor

Browser Details

Brave\Chrome

Exact BookStack Version

25.05.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions