update-url command does not affect draft urls #5027

Closed
opened 2026-02-05 09:34:47 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @Tassleh0ff on GitHub (Oct 27, 2024).

Describe the Bug

Moving around my Bookstack instance between different hostnames and adding a context to it I noticed a problem that feels like a bug to me and involves the bookstack:update-url command.

It seems like that the bookstack:update-url do not affect resources urls added to a draft page prior to the bookstack:update-url (plus cache:clear and change to the APP_URL variable in the Bookstack configuration).

Steps to Reproduce

  1. create a new page adding an image and save it ( example url http://bookstack.domain.tld:6875/uploads/images/gallery/2024-10/image.png )
  2. edit the page and add a second image (url http://bookstack.domain.tld:6875/uploads/images/gallery/2024-10/cetimage.png )
  3. save the draft without saving the page
  4. change APP_URL config variable to the new url ( http://newbookstack.domain.tld:6875 )
  5. update resources urls in the database
    docker exec -it bookstack php /app/www/artisan bookstack:update-url http://bookstack.domain.tld:6875 http://newbookstack.domain.tld:6875
  6. clear cache
    docker exec -it bookstack php /app/www/artisan cache:clear
  7. restart Bookstack container to apply the new APP_URL config variable (in case you're using a container env variable)

Opening the page (the last saved version of the page with only the first image) the image url is ok ( http://newbookstack.domain.tld:6875/uploads/images/gallery/2024-10/image.png ).

If you edit the page Bookstack recovers the latest draft with the two images, if you save the page turning the latest draft into the new page version the url of the two images keep using the old url as the update-url command did not affected them.

As a result the two images ends up having urls
http://bookstack.domain.tld:6875/uploads/images/gallery/2024-10/image.png
http://bookstack.domain.tld:6875/uploads/images/gallery/2024-10/cetimage.png

instead of
http://newbookstack.domain.tld:6875/uploads/images/gallery/2024-10/image.png
http://newbookstack.domain.tld:6875/uploads/images/gallery/2024-10/cetimage.png

Expected Behaviour

After running the update-url command the saved draft should also update their resources url to the new url, so in this case the new page version (after a draft recovery) should have image urls using the new APP_URL value.

Screenshots or Additional Context

No response

Browser Details

All browsers

Exact BookStack Version

v24.10

Originally created by @Tassleh0ff on GitHub (Oct 27, 2024). ### Describe the Bug Moving around my Bookstack instance between different hostnames and adding a context to it I noticed a problem that feels like a bug to me and involves the bookstack:update-url command. It seems like that the bookstack:update-url do not affect resources urls added to a draft page prior to the bookstack:update-url (plus cache:clear and change to the APP_URL variable in the Bookstack configuration). ### Steps to Reproduce 1. create a new page adding an image and save it ( example url http://bookstack.domain.tld:6875/uploads/images/gallery/2024-10/image.png ) 2. edit the page and add a second image (url http://bookstack.domain.tld:6875/uploads/images/gallery/2024-10/cetimage.png ) 3. save the draft **without saving the page** 4. change APP_URL config variable to the new url ( http://newbookstack.domain.tld:6875 ) 5. update resources urls in the database `docker exec -it bookstack php /app/www/artisan bookstack:update-url http://bookstack.domain.tld:6875 http://newbookstack.domain.tld:6875` 6. clear cache `docker exec -it bookstack php /app/www/artisan cache:clear` 7. restart Bookstack container to apply the new APP_URL config variable (in case you're using a container env variable) Opening the page (the last saved version of the page with only the first image) the image url is ok ( http://newbookstack.domain.tld:6875/uploads/images/gallery/2024-10/image.png ). If you edit the page Bookstack recovers the latest draft with the two images, if you save the page turning the latest draft into the new page version the url of the two images keep using the old url as the update-url command did not affected them. As a result the two images ends up having urls http://bookstack.domain.tld:6875/uploads/images/gallery/2024-10/image.png http://bookstack.domain.tld:6875/uploads/images/gallery/2024-10/cetimage.png instead of http://newbookstack.domain.tld:6875/uploads/images/gallery/2024-10/image.png http://newbookstack.domain.tld:6875/uploads/images/gallery/2024-10/cetimage.png ### Expected Behaviour After running the update-url command the saved draft should also update their resources url to the new url, so in this case the new page version (after a draft recovery) should have image urls using the new APP_URL value. ### Screenshots or Additional Context _No response_ ### Browser Details All browsers ### Exact BookStack Version v24.10
OVERLORD added the 🐛 Bug label 2026-02-05 09:34:47 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Nov 8, 2024):

Thanks for raising @Tassleh0ff.

This seemed like a significant omission, so I've been trying to think why the revisions table was left out. Maybe to respect that state of history as authoritive? But that doesn't seem a great reason since there's a chance of leading to wider issues, and since we show plenty of warnings of changes when running the command.

I've now applied 7017a1cae5 so that the revisions (which includes user drafts) are considered by this command. This will be part of the next patch release.

@ssddanbrown commented on GitHub (Nov 8, 2024): Thanks for raising @Tassleh0ff. This seemed like a significant omission, so I've been trying to think why the revisions table was left out. Maybe to respect that state of history as authoritive? But that doesn't seem a great reason since there's a chance of leading to wider issues, and since we show plenty of warnings of changes when running the command. I've now applied 7017a1cae59353fd3d94683ae8f30a98bad5c559 so that the revisions (which includes user drafts) are considered by this command. This will be part of the next patch release.
Author
Owner

@Tassleh0ff commented on GitHub (Nov 9, 2024):

No, thanks to you @ssddanbrown for the excellent work!

@Tassleh0ff commented on GitHub (Nov 9, 2024): No, thanks to you @ssddanbrown for the excellent work!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5027