From e9688d295fe0a0cd57e8677ba597631a833445bb Mon Sep 17 00:00:00 2001 From: Andi Permana Date: Tue, 25 Nov 2025 10:38:39 +0700 Subject: [PATCH] MDL-86830 calendar: Fix double encoding in event title attributes --- .../classes/external/event_exporter_base.php | 2 +- calendar/tests/behat/calendar.feature | 30 +++++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/calendar/classes/external/event_exporter_base.php b/calendar/classes/external/event_exporter_base.php index 527444da034..2381938ac9a 100644 --- a/calendar/classes/external/event_exporter_base.php +++ b/calendar/classes/external/event_exporter_base.php @@ -70,7 +70,7 @@ class event_exporter_base extends exporter { $data = new \stdClass(); $data->id = $event->get_id(); - $data->name = $event->get_name(); + $data->name = clean_string($event->get_name()); $data->description = file_rewrite_pluginfile_urls( $event->get_description()->get_value(), 'pluginfile.php', diff --git a/calendar/tests/behat/calendar.feature b/calendar/tests/behat/calendar.feature index 80667d7d865..ac4b4e58cf8 100644 --- a/calendar/tests/behat/calendar.feature +++ b/calendar/tests/behat/calendar.feature @@ -15,11 +15,11 @@ Feature: Perform basic calendar functionality | name | category | idnumber | | CatA | 0 | cata | And the following "courses" exist: - | fullname | shortname | format | category | - | Course 1 | C1 | topics | cata | - | Course 2 | C2 | topics | cata | - | Course 3 | C3 | topics | cata | - | Course 4 | C4 | topics | cata | + | fullname | shortname | format | category | startdate | + | Course 1 | C1 | topics | cata | ##first day of last month## | + | Course 2 | C2 | topics | cata | ##first day of last month## | + | Course 3 | C3 | topics | cata | ##first day of last month## | + | Course 4 | C4 | topics | cata | ##first day of last month## | And the following "course enrolments" exist: | user | course | role | | student1 | C1 | student | @@ -58,20 +58,24 @@ Feature: Perform basic calendar functionality Scenario: Create a course event Given I log in as "teacher1" And I create a calendar event with form data: - | Type of event | course | - | Course | Course 1 | - | Event title | Really awesome event! | - | Description | Come join this awesome event, sucka! | + | Type of event | course | + | Course | Course 1 | + | timestart[day] | 1 | + | Event title | Really awesome event! & < > " ' | + | Description | Come join this awesome event, sucka! | And I log out When I am on the "Course 1" course page logged in as student1 And I follow "Course calendar" - And I click on "Really awesome event!" "link" - And "Course 1" "link" should exist in the "Really awesome event!" "dialogue" - And I click on "Close" "button" in the "Really awesome event!" "dialogue" + And I hover over day "1" of this month in the full calendar page + And I should see "Really awesome event! & < > \" '" + And I click on "Really awesome event! & < > \" '" "link" + And I should see "Really awesome event! & < > \" '" in the ".modal-title" "css_element" + And I should see "Course 1" in the ".modal-body" "css_element" + And I click on "Close" "button" in the ".modal-content" "css_element" And I log out And I log in as "student2" And I follow "Full calendar" - Then I should not see "Really awesome event!" + Then I should not see "Really awesome event! & < > \" '" @javascript Scenario: Create a group event