Closing HTML tags getting removed from Custom Header content inside of a script tag. #2378

Closed
opened 2026-02-05 03:52:41 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @tsacks on GitHub (Sep 6, 2021).

Describe the bug
When putting custom HTML inside of a <script> tag, all closing tags are removed.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Start with a fresh install of BookStack
  2. Add the following to the Custom HTML Head Content:
<script>
<div></div>
</script>
  1. View the page source on any page in the wiki.
  2. See that the inserted content is only:
<script>
<div>
</script>

Expected behavior
I expected the closing tags to not be scrubbed from the custom HTML field.

Your Configuration (please complete the following information):

  • Exact BookStack Version (Found in settings): v21.08.2
  • PHP Version: 7.4.21
  • Hosting Method (Nginx/Apache/Docker): Nginx

Additional context
I am attempting to work on a new solution for custom Markdown parsing, resolving ticket #2761

Originally created by @tsacks on GitHub (Sep 6, 2021). **Describe the bug** When putting custom HTML inside of a <script> tag, all closing tags are removed. **Steps To Reproduce** Steps to reproduce the behavior: 1. Start with a fresh install of BookStack 2. Add the following to the Custom HTML Head Content: ``` <script> <div></div> </script> ``` 3. View the page source on any page in the wiki. 4. See that the inserted content is only: ``` <script> <div> </script> ``` **Expected behavior** I expected the closing tags to not be scrubbed from the custom HTML field. **Your Configuration (please complete the following information):** - Exact BookStack Version (Found in settings): v21.08.2 - PHP Version: 7.4.21 - Hosting Method (Nginx/Apache/Docker): Nginx **Additional context** I am attempting to work on a new solution for custom Markdown parsing, resolving ticket #2761
OVERLORD added the 🐛 Bug🏭 Back-End labels 2026-02-05 03:52:41 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Sep 6, 2021):

Thanks for reporting @tsacks.

Bit of a strange one, due to how PHP parses HTML tags now that I parse the content in the last patch release. I've now pushed 88c698796b which seems to fix this. That said, not really sure how or why it fixes it but seems to do the job and not cause any other issues from my testing.

Therefore I'll close this off. This will be part of the next patch release.

@ssddanbrown commented on GitHub (Sep 6, 2021): Thanks for reporting @tsacks. Bit of a strange one, due to how PHP parses HTML tags now that I parse the content in the last patch release. I've now pushed 88c698796b2097301d494a9109631aa2bc96ec48 which seems to fix this. That said, not really sure how or why it fixes it but seems to do the job and not cause any other issues from my testing. Therefore I'll close this off. This will be part of the next patch release.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2378