Skip to content

Commit

Permalink
FIX: Better HTML decoding support
Browse files Browse the repository at this point in the history
  • Loading branch information
angusmcleod committed May 1, 2024
1 parent 99325e1 commit b0d4523
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/discourse-publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ protected function get_excluded_tag_slugs() {
* @return string
*/
protected function sanitize_title( $title ) {
return wp_specialchars_decode( wp_strip_all_tags( $title ) );
return html_entity_decode( wp_strip_all_tags( $title ), ENT_COMPAT, 'UTF-8' );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/test-discourse-publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -858,8 +858,8 @@ public function test_force_publish_max_age_prevents_older_posts_from_being_publi
* Test that HTML entities are converted to their special characters.
*/
public function test_conversion_of_html_entities_in_title() {
$title_with_entities = 'Title with &';
$title_with_decoded_entities = 'Title with &';
$title_with_entities = 'Title with & and –';
$title_with_decoded_entities = 'Title with & and –';
self::$post_atts['post_title'] = $title_with_entities;

$response = $this->build_response( 'success' );
Expand Down

0 comments on commit b0d4523

Please sign in to comment.