mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 08:55:15 +02:00
moodlellib: MDL-19828 PARAM_LOCALURL should accept URLs like course/view.php?id=2
This commit is contained in:
parent
a475c67308
commit
4bea5e8582
@ -529,7 +529,7 @@ function clean_param($param, $type) {
|
||||
// absolute, and matches our wwwroot
|
||||
} else {
|
||||
// relative - let's make sure there are no tricks
|
||||
if (validateUrlSyntax($param, 's-u-P-a-p-f+q?r?')) {
|
||||
if (validateUrlSyntax('/' . $param, 's-u-P-a-p-f+q?r?')) {
|
||||
// looks ok.
|
||||
} else {
|
||||
$param = '';
|
||||
|
@ -296,6 +296,7 @@ class moodlelib_test extends UnitTestCase {
|
||||
$this->assertEqual(clean_param($CFG->wwwroot, PARAM_LOCALURL), $CFG->wwwroot);
|
||||
$this->assertEqual(clean_param('/just/a/path', PARAM_LOCALURL), '/just/a/path');
|
||||
$this->assertEqual(clean_param('funny:thing', PARAM_LOCALURL), '');
|
||||
$this->assertEqual(clean_param('course/view.php?id=3', PARAM_LOCALURL), 'course/view.php?id=3');
|
||||
}
|
||||
|
||||
function test_make_user_directory() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user