Content of HTML <script> and <style> is not removed from API return data #1702

Closed
opened 2026-10-05 00:53:28 +02:00 by adam · 1 comment
Owner

Context

This occured when an album's description contains HTML :

<style>
.additional_info { max-width:9999px; }
.additional_info p { text-align:center; }
.additional_info iframe { margin:0px auto; display:block; }
</style>

Issue

Currently, the server removes all markups like <style> and </style>. However the content in between stays and markups are replaced by line breaks :

id: "131",
name: "My album",
comment: "

.additional_info { max-width:9999px; }
.additional_info p { text-align:center; }
.additional_info iframe { margin:0px auto; display:block; }

",

Expected

The server should then remove this content, for both <style> and <script> which should not be displayed.

# Context This occured when an album's description contains HTML : ```html <style> .additional_info { max-width:9999px; } .additional_info p { text-align:center; } .additional_info iframe { margin:0px auto; display:block; } </style> ``` # Issue Currently, the server removes all markups like `<style>` and `</style>`. However the content in between stays and markups are replaced by line breaks : ``` id: "131", name: "My album", comment: " .additional_info { max-width:9999px; } .additional_info p { text-align:center; } .additional_info iframe { margin:0px auto; display:block; } ", ``` # Expected The server should then remove this content, for both <style> and <script> which should not be displayed. <!-- github-sync-id:1832899210 -->
adam closed this issue 2026-10-05 00:53:28 +02:00
Author
Owner

When $conf['allow_html_descriptions'] = true, the API method pwg.categories.getList should return the whole HTML description but it does not. And when $conf['allow_html_descriptions'] = false, the content in between markups should indeed not stay and markups should also not be replaced by line breaks.

When `$conf['allow_html_descriptions'] = true`, the API method `pwg.categories.getList` should return the whole HTML description but it does not. And when `$conf['allow_html_descriptions'] = false`, the content in between markups should indeed not stay and markups should also not be replaced by line breaks. <!-- github-comment-id:3172595022 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1702