Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update-url command does not affect draft urls #5292

Closed
Tassleh0ff opened this issue Oct 27, 2024 · 2 comments
Closed

update-url command does not affect draft urls #5292

Tassleh0ff opened this issue Oct 27, 2024 · 2 comments
Labels
Milestone

Comments

@Tassleh0ff
Copy link

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

@Tassleh0ff Tassleh0ff changed the title update-url command does not effect draft urls update-url command does not affect draft urls Oct 27, 2024
@ssddanbrown ssddanbrown added this to the v24.10.1 milestone Nov 7, 2024
ssddanbrown added a commit that referenced this issue Nov 8, 2024
@ssddanbrown
Copy link
Member

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 7017a1c so that the revisions (which includes user drafts) are considered by this command. This will be part of the next patch release.

@Tassleh0ff
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants
@Tassleh0ff @ssddanbrown and others