From b48cb6861e07a3f7f045337db07232978a581208 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Thu, 21 Nov 2024 09:02:33 +0000 Subject: [PATCH] MDL-83776 customfield_text: correct link field URL encoding. --- .../field/text/classes/data_controller.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/customfield/field/text/classes/data_controller.php b/customfield/field/text/classes/data_controller.php index d3ff817af61..e628b1e6945 100644 --- a/customfield/field/text/classes/data_controller.php +++ b/customfield/field/text/classes/data_controller.php @@ -14,24 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Customfields text field plugin - * - * @package customfield_text - * @copyright 2018 Daniel Neis Araujo - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace customfield_text; -defined('MOODLE_INTERNAL') || die; - -use core_customfield\api; - /** * Class data * - * @package customfield_text + * @package customfield_text * @copyright 2018 Daniel Neis Araujo * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -105,8 +93,8 @@ class data_controller extends \core_customfield\data_controller { $link = $this->get_field()->get_configdata_property('link'); if ($link) { + $url = new \moodle_url(str_replace('$$', $this->get_value(), $link)); $linktarget = $this->get_field()->get_configdata_property('linktarget'); - $url = str_replace('$$', urlencode($this->get_value()), $link); $attributes = $linktarget ? ['target' => $linktarget] : []; $value = \html_writer::link($url, $value, $attributes); }