MDL-81781 report_log: escape description selectively on display/export.

Per cd85e090f3 all content was escaped, however we should only do that
when displaying the value in browser or exporting to file format which
supports HTML.
This commit is contained in:
Paul Holden
2024-06-07 11:31:02 +01:00
parent daebafdb2d
commit 2a72cf032d
+7 -2
View File
@@ -22,9 +22,11 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use core\dataformat;
use core\report_helper;
defined('MOODLE_INTERNAL') || die;
global $CFG;
require_once($CFG->libdir . '/tablelib.php');
@@ -299,8 +301,11 @@ class report_log_table_log extends table_sql {
* @return string HTML for the description column
*/
public function col_description($event) {
// Description.
return format_text($event->get_description(), FORMAT_PLAIN);
if (empty($this->download) || dataformat::get_format_instance($this->download)->supports_html()) {
return format_text($event->get_description(), FORMAT_PLAIN);
} else {
return $event->get_description();
}
}
/**