homeylab / bookstack-file-exporter

This tool provides a way to export bookstack pages in a folder-tree layout into object storage or locally.
MIT License
15 stars 4 forks source link

404 Error on image-gallery #33

Closed intrepidsilence closed 9 months ago

intrepidsilence commented 9 months ago

Hello. I am trying to use this against our Bookstack but I get the following error:

2024-01-11 09:11:34 [DEBUG] https://wiki.corp.NOPE.com:443 "GET /api/image-gallery HTTP/1.1" 404 None
2024-01-11 09:11:34 [ERROR] Bookstack request failed with status code: 404 on url: https://wiki.corp.NOPE.com/api/image-gallery
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/opt/homebrew/lib/python3.11/site-packages/bookstack_file_exporter/__main__.py", line 16, in <module>
    main()
  File "/opt/homebrew/lib/python3.11/site-packages/bookstack_file_exporter/__main__.py", line 12, in main
    run.exporter(args)
  File "/opt/homebrew/lib/python3.11/site-packages/bookstack_file_exporter/run.py", line 45, in exporter
    archive.get_bookstack_exports(page_nodes)
  File "/opt/homebrew/lib/python3.11/site-packages/bookstack_file_exporter/archiver/archiver.py", line 44, in get_bookstack_exports
    all_image_meta = self._get_page_image_map()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/bookstack_file_exporter/archiver/archiver.py", line 61, in _get_page_image_map
    return self._page_archiver.get_image_meta()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/bookstack_file_exporter/archiver/page_archiver.py", line 140, in get_image_meta
    img_meta_response: Response = common_util.http_get_request(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/bookstack_file_exporter/common/util.py", line 37, in http_get_request
    raise e
  File "/opt/homebrew/lib/python3.11/site-packages/bookstack_file_exporter/common/util.py", line 31, in http_get_request
    response.raise_for_status()
  File "/opt/homebrew/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://wiki.corp.NOPE.com/api/image-gallery

Why would this be looking for something we don't have?

intrepidsilence commented 9 months ago

Could it be that image-gallery is now attachments?

pchang388 commented 9 months ago

hey @intrepidsilence

Thanks for raising the issue! At first glance, this one seems odd, the exporter appears to be trying to do a normal image gathering via the api/image-gallery endpoint as documented here in the demo instance as an example.

Is it perhaps a version difference in the Bookstack instance I use v23.X for testing and yours? Could you provide a few more details?

  1. What version of Bookstack is currently running?
  2. Recent versions of Bookstack should include the docs API and you should be able to see it via your host example: https://wiki.corp.NOPE.com/api/docs. Do you see image-gallery endpoint similar to the demo one I linked?
  3. Is it possible you don't have any images on pages and we are just getting a 404 because of that? If so, could you try setting false to image export configuration property? Or if there are images, try hitting that endpoint directly to see what your response is?

Thanks!

intrepidsilence commented 9 months ago
  1. BookStack v23.02.3
  2. No image-gallery endpoint is listed on the api docs page
  3. We do have images. When trying to visit the endpoint for the image-gallery api I get:
    Page Not Found
    Sorry, The page you were looking for could not be found.
intrepidsilence commented 9 months ago

Found this was a problem with our installation. Closing this ticket for now. Waiting on a run to finish. Fingers crossed it works now. Thanks!