From e1e63cf50d16c04dcfa01cc182493ee53621716b Mon Sep 17 00:00:00 2001 From: Greg Ross Date: Sun, 7 Jan 2024 19:54:19 -0500 Subject: [PATCH] Make sure to decode html_entities for blog_info() Site titles and descriptions are html entity encoded when stored in the database so convert them back to plain text before adding them to the api return values. --- includes/class-mastodon-api.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/class-mastodon-api.php b/includes/class-mastodon-api.php index 831b6133..76fb6d79 100644 --- a/includes/class-mastodon-api.php +++ b/includes/class-mastodon-api.php @@ -2725,8 +2725,8 @@ public function api_nodeinfo() { $software = apply_filters( 'mastodon_api_nodeinfo_software', $software ); $ret = array( 'metadata' => array( - 'nodeName' => get_bloginfo( 'name' ), - 'nodeDescription' => get_bloginfo( 'description' ), + 'nodeName' => html_entity_decode( get_bloginfo( 'name' ), ENT_QUOTES ), + 'nodeDescription' => html_entity_decode( get_bloginfo( 'description' ), ENT_QUOTES ), 'software' => $software, 'config' => array( 'features' => array( @@ -2812,9 +2812,9 @@ public function api_announcements() { public function api_instance() { $ret = array( - 'title' => get_bloginfo( 'name' ), - 'description' => get_bloginfo( 'description' ), - 'short_description' => get_bloginfo( 'description' ), + 'title' => html_entity_decode( get_bloginfo( 'name' ), ENT_QUOTES ), + 'description' => html_entity_decode( get_bloginfo( 'description' ), ENT_QUOTES ), + 'short_description' => html_entity_decode( get_bloginfo( 'description' ), ENT_QUOTES ), 'email' => 'not@public.example', 'version' => $this->software_string(), 'stats' => array(