Revision diff view breaks with a mass of content within the page #2054

Closed
opened 2026-02-05 02:44:34 +03:00 by OVERLORD · 7 comments
Owner

Originally created by @Tealk on GitHub (Jan 21, 2021).

Describe the bug
When I go to the changes I get only a white page displayed, I noticed this since the last update.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Go to 'https://books.rollenspiel.monster/books/grundregelwerk/page/6-aspekte/revisions'
  2. Click on 'changes'
  3. See a blank page

Expected behavior
That the changes of the page are displayed.

Screenshots
If applicable, add screenshots to help explain your problem.

Your Configuration (please complete the following information):

  • Exact BookStack Version (Found in settings): BookStack v0.31.4
  • PHP Version: 7.4.14
  • Hosting Method (Nginx/Apache/Docker): nginx

Additional context
nginx error.log

2021/01/21 20:53:36 [error] 1014#1014: *1917097 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /var/customers/webs/Anzah/books.rollenspiel.monster/vendor/ssddanbrown/htmldiff/src/WordSplitter.php on line 23PHP message: PHP Fatal error:  Uncaught ErrorException: file_exists(): open_basedir restriction in effect. File(/de/errors.php) is not within the allowed path(s): (/var/customers/webs/Anzah/books.rollenspiel.monster:/var/customers/tmp/Anzah:/usr/share/php:/usr/share/php5:/tmp) in /var/customers/webs/Anzah/books.rollenspiel.monster/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:23
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1 /var/customers/webs/Anzah/books.rollenspiel.monster/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(23): file_exists()
#2 /var/customers/webs/Anzah/books.rollenspiel.monster/vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php(122): Illuminate\Filesystem\Filesystem->exists()
#3 /var/customers/webs/Anzah/books.rollenspiel.monster/app/Translation/FileLoader.php(23): Illuminate\Translation\FileLoader->loadPath()
#4 /var/customers/webs/Anzah/books.rollenspiel.monster/vendor" while reading response header from upstream, client: 93.212.21.103, server: books.rollenspiel.monster, request: "GET /books/grundregelwerk/page/6-aspekte/revisions/336/changes HTTP/2.0", upstream: "fastcgi://unix:/var/lib/fastcgi/1-anzah-books.rollenspiel.monster-php-fpm.socket:", host: "books.rollenspiel.monster", referrer: "https://books.rollenspiel.monster/books/grundregelwerk/page/6-aspekte/revisions"
Originally created by @Tealk on GitHub (Jan 21, 2021). **Describe the bug** When I go to the changes I get only a white page displayed, I noticed this since the last update. **Steps To Reproduce** Steps to reproduce the behavior: 1. Go to 'https://books.rollenspiel.monster/books/grundregelwerk/page/6-aspekte/revisions' 2. Click on 'changes' 4. See a blank page **Expected behavior** That the changes of the page are displayed. **Screenshots** If applicable, add screenshots to help explain your problem. **Your Configuration (please complete the following information):** - Exact BookStack Version (Found in settings): BookStack v0.31.4 - PHP Version: 7.4.14 - Hosting Method (Nginx/Apache/Docker): nginx **Additional context** nginx error.log ``` 2021/01/21 20:53:36 [error] 1014#1014: *1917097 FastCGI sent in stderr: "PHP message: PHP Fatal error: Maximum execution time of 30 seconds exceeded in /var/customers/webs/Anzah/books.rollenspiel.monster/vendor/ssddanbrown/htmldiff/src/WordSplitter.php on line 23PHP message: PHP Fatal error: Uncaught ErrorException: file_exists(): open_basedir restriction in effect. File(/de/errors.php) is not within the allowed path(s): (/var/customers/webs/Anzah/books.rollenspiel.monster:/var/customers/tmp/Anzah:/usr/share/php:/usr/share/php5:/tmp) in /var/customers/webs/Anzah/books.rollenspiel.monster/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:23 Stack trace: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() #1 /var/customers/webs/Anzah/books.rollenspiel.monster/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(23): file_exists() #2 /var/customers/webs/Anzah/books.rollenspiel.monster/vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php(122): Illuminate\Filesystem\Filesystem->exists() #3 /var/customers/webs/Anzah/books.rollenspiel.monster/app/Translation/FileLoader.php(23): Illuminate\Translation\FileLoader->loadPath() #4 /var/customers/webs/Anzah/books.rollenspiel.monster/vendor" while reading response header from upstream, client: 93.212.21.103, server: books.rollenspiel.monster, request: "GET /books/grundregelwerk/page/6-aspekte/revisions/336/changes HTTP/2.0", upstream: "fastcgi://unix:/var/lib/fastcgi/1-anzah-books.rollenspiel.monster-php-fpm.socket:", host: "books.rollenspiel.monster", referrer: "https://books.rollenspiel.monster/books/grundregelwerk/page/6-aspekte/revisions" ```
OVERLORD added the 🛠️ Enhancement🏭 Back-End labels 2026-02-05 02:44:34 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jan 22, 2021):

Thanks for raising @Tealk.

We did swap out the diff library in the latest release which can affect things.

Looking at your page, I can see there's a lot going on in the HTML code of the content. There are a lot of additional attributes and non-visible elements within the code. Looks like the content may have been created or copied from a platform using the "Slate" editor?

One thing in the code is a large amount of base64 encoded content (About 54KB worth). From my testing, removing just that improves things massively. I've opened (https://github.com/ssddanbrown/HtmlDiff/issues/1) to look into that further but ideally that would not be in your page content.
I'd imagine all the other content in the code is also having an affect here.

@ssddanbrown commented on GitHub (Jan 22, 2021): Thanks for raising @Tealk. We did swap out the diff library in the latest release which can affect things. Looking at your page, I can see there's a lot going on in the HTML code of the content. There are a lot of additional attributes and non-visible elements within the code. Looks like the content may have been created or copied from a platform using the "Slate" editor? One thing in the code is a large amount of base64 encoded content (About 54KB worth). From my testing, removing just that improves things massively. I've opened (https://github.com/ssddanbrown/HtmlDiff/issues/1) to look into that further but ideally that would not be in your page content. I'd imagine all the other content in the code is also having an affect here.
Author
Owner

@Tealk commented on GitHub (Jan 22, 2021):

Thanks for the quick reply

How can I remove this?
I copied the texts from a PDF which I created using LaTeX.

@Tealk commented on GitHub (Jan 22, 2021): Thanks for the quick reply How can I remove this? I copied the texts from a PDF which I created using LaTeX.
Author
Owner

@ssddanbrown commented on GitHub (Jan 22, 2021):

@Tealk I can't think of really simple way unfortunately, the editor does some cleaning rules but this content seems to miss detection.

I've created a little cleaner for this here though: https://jsfiddle.net/ssddanbrown/8tf5opda/20/
Just paste the raw HTML content in the ouput and get cleaned stuff in the output, Should have minimal affect on styles and not touch text.
There's a button in the editor toolbar, towards the right to get/set the raw code.

@ssddanbrown commented on GitHub (Jan 22, 2021): @Tealk I can't think of really simple way unfortunately, the editor does some cleaning rules but this content seems to miss detection. I've created a little cleaner for this here though: https://jsfiddle.net/ssddanbrown/8tf5opda/20/ Just paste the raw HTML content in the ouput and get cleaned stuff in the output, Should have minimal affect on styles and not touch text. There's a button in the editor toolbar, towards the right to get/set the raw code.
Author
Owner

@Tealk commented on GitHub (Jan 22, 2021):

Thanks for the script, there seems to have been some superfluous code in it

IN: 151052; OUT: 11396; (chars)
IN: 21261; OUT: 8031; (chars)
IN: 77611; OUT: 14238; (chars)
IN: 92279; OUT: 16209; (chars)
IN: 9037; OUT: 1907; (chars)
IN: 105235; OUT: 6908; (chars)

Is it possible to make a one-time donation for your project?

@Tealk commented on GitHub (Jan 22, 2021): Thanks for the script, there seems to have been some superfluous code in it ``` IN: 151052; OUT: 11396; (chars) IN: 21261; OUT: 8031; (chars) IN: 77611; OUT: 14238; (chars) IN: 92279; OUT: 16209; (chars) IN: 9037; OUT: 1907; (chars) IN: 105235; OUT: 6908; (chars) ``` Is it possible to make a one-time donation for your project?
Author
Owner

@ssddanbrown commented on GitHub (Jan 23, 2021):

Awesome, Gald that helped! Did that get the "Changes" view working? (Might still not be able to see changes between the old and cleaned code, only between two cleaned revisions).

There only donation channel i have is github sponsors (https://github.com/sponsors/ssddanbrown) but it's re-occuring although you could probably cancel right after. It's not needed at all though.

@ssddanbrown commented on GitHub (Jan 23, 2021): Awesome, Gald that helped! Did that get the "Changes" view working? (Might still not be able to see changes between the old and cleaned code, only between two cleaned revisions). There only donation channel i have is github sponsors (https://github.com/sponsors/ssddanbrown) but it's re-occuring although you could probably cancel right after. It's not needed at all though.
Author
Owner

@Tealk commented on GitHub (Jan 23, 2021):

Yes the changes can be seen only from the corrected version.

this is a very good project and your commitment to solve my problem is also wonderful, something like this deserves support

@Tealk commented on GitHub (Jan 23, 2021): Yes the changes can be seen only from the corrected version. this is a very good project and your commitment to solve my problem is also wonderful, something like this deserves support
Author
Owner

@ssddanbrown commented on GitHub (Jan 29, 2021):

Thanks @Tealk,

I've now dived into the diffing library and found the biggest point of slowdown, which would have originally led you a white screen.
Changes in 73f41bd4d2 should speed things up by 20x from my testing, maybe more/less depending on content.

This updated version of the library is now in the main branch, ready to be part of the next feature release so I will close this off.

@ssddanbrown commented on GitHub (Jan 29, 2021): Thanks @Tealk, I've now dived into the diffing library and found the biggest point of slowdown, which would have originally led you a white screen. Changes in https://github.com/ssddanbrown/HtmlDiff/commit/73f41bd4d23b1b9e3860aeaefdddd212c580f2ed should speed things up by 20x from my testing, maybe more/less depending on content. This updated version of the library is now in the main branch, ready to be part of the next feature release so I will close this off.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2054