mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-06 09:09:38 +03:00
While updating with API (/api/pages/{id}) Revision-Counter increases, but not the Content and not the Revision List #4410
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @DarthDestroyer on GitHub (Jan 16, 2024).
Describe the Bug
We created a small Script, updating a Page with HTML Content.
The HTML Content is around 200.000 Chars long...
It has seemed to work, so we continued but now to the Problem!
When we start the Script, everything looks good - no errors, no failure or any negativ result.
The Revision Counter increases, the Content does not Change and no entry at all is shown in the Revision Overview!
That is all through Powershell! When we test the same Request with Postman (same body-content) everything seems fine!
Revision Overview

Result from Postman (same result in Powershell)

Steps to Reproduce
Expected Behaviour
Screenshots or Additional Context
No response
Browser Details
No response
Exact BookStack Version
v23.12.1
@DarthDestroyer commented on GitHub (Jan 16, 2024):
When i set the same HTML Content with the Editor - everything works, too!
@ssddanbrown commented on GitHub (Jan 16, 2024):
The only thing I can see in your code from a quick scan without running, is that the ContentType is set twice. Powershell 7.4 adds specific handling for that, but not sure what happens on previous versions. If using an older powershell version, might be worth removing one of these to see if things change.
@DarthDestroyer commented on GitHub (Jan 16, 2024):
Tried without before, had seen a Post about Powershell to set it... But it made no difference at all
Thanks for your check!
I dont understand it at the Moment!
Why does it not fail? Why is it increasing the rev-counter and why is there no content change?
Any Log, i can provide or look at?
@DarthDestroyer commented on GitHub (Jan 17, 2024):
I would say, powershell is the problem here...
when i call a php script, which does nothing else as reading the same request and reissue it against the api - same content, same url, same page, also on PUT Method - it works fine!
Cant find the Issue in Powershell... =/
@DarthDestroyer commented on GitHub (Jan 17, 2024):
Back to the Roots... Same Result!
It does not seem to be a Rate-Limit, there would be an error - or not?
@DarthDestroyer commented on GitHub (Jan 19, 2024):
Nevermind... I've found the Problem!
It is/was powershell!
Problem here and with the example, is this Function ConvertTo-Json!
Microsoft changed the behavior for escaping at some Version!
The tested 5.1 powershell Version failed, because of escaping html to
group\u003e \u003ctr\u003e\u003cth\u003eDisplayName\u003c/th\u003e\u003cth\u003eDepartment\uwith powershell 7 to
group> <tr><th>DisplayName</th><th>Department</th>All these Characters brought bookstack out of mind!
Like i said, everything seems to work! No Error... Increasing Rev-Counter but no Entry in the Revision-List
Maybe, this helps someone someday - Probably it could / shoud get catched, as an error!
@ssddanbrown commented on GitHub (Jan 22, 2024):
Thanks for sharing your findings @DarthDestroyer.
from my testing, BookStack should work fine with unicode escapes in JSON content, but it may have been something specific in the exact content you had, and/or the exact resultant formatting.
Since this is resolved I'll close this off.
If anyone finds a specific issue with unicode escapes in JSON, feel free to raise via a specific issue.
In regard to the revision count, that can occur. The page revision count increments on any change, whereas a revision is only stored when a change is made to the name/html, or a summary has been set. There's existing issue #2373 related to problematic revision numbering that I'd consider this to be part of, I'll reference this issue to make that part of revision numbering a consideration there too.
@DarthDestroyer commented on GitHub (Jan 22, 2024):
I just pushed html code and it has changed through the revisions... Thats what i've meant with "when i edit the page and change the html by hand" and it does change after that.