mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
MDL-59273 core: Remove mailto links support in clean_param.
This commit is contained in:
parent
229ae617c5
commit
e5ece45e84
@ -1033,10 +1033,11 @@ function clean_param($param, $type) {
|
||||
}
|
||||
return $param;
|
||||
|
||||
case PARAM_URL: // Allow safe ftp, http, mailto urls.
|
||||
case PARAM_URL:
|
||||
// Allow safe urls.
|
||||
$param = fix_utf8($param);
|
||||
include_once($CFG->dirroot . '/lib/validateurlsyntax.php');
|
||||
if (!empty($param) && validateUrlSyntax($param, 's?H?S?F?E?u-P-a?I?p?f?q?r?')) {
|
||||
if (!empty($param) && validateUrlSyntax($param, 's?H?S?F?E-u-P-a?I?p?f?q?r?')) {
|
||||
// All is ok, param is respected.
|
||||
} else {
|
||||
// Not really ok.
|
||||
|
@ -615,6 +615,9 @@ class core_moodlelib_testcase extends advanced_testcase {
|
||||
$this->assertSame('', clean_param('rtmp://example.com/livestream', PARAM_URL));
|
||||
$this->assertSame('', clean_param('rtmp://example.com/live&foo', PARAM_URL));
|
||||
$this->assertSame('', clean_param('rtmp://example.com/fms&mp4:path/to/file.mp4', PARAM_URL));
|
||||
$this->assertSame('', clean_param('mailto:support@moodle.org', PARAM_URL));
|
||||
$this->assertSame('', clean_param('mailto:support@moodle.org?subject=Hello%20Moodle', PARAM_URL));
|
||||
$this->assertSame('', clean_param('mailto:support@moodle.org?subject=Hello%20Moodle&cc=feedback@moodle.org', PARAM_URL));
|
||||
}
|
||||
|
||||
public function test_clean_param_localurl() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user