MDL-38419: External tool - when force SSL checked, URLs get corrupted
This commit is contained in:
committed by
Dan Poltawski
parent
59f8555512
commit
0f0fa7a86c
@@ -1168,7 +1168,7 @@ function lti_ensure_url_is_https($url) {
|
||||
} else {
|
||||
//If the URL starts with http, replace with https
|
||||
if (stripos($url, 'http://') === 0) {
|
||||
$url = 'https://' . substr($url, 8);
|
||||
$url = 'https://' . substr($url, 7);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -139,4 +139,10 @@ class mod_lti_locallib_testcase extends basic_testcase {
|
||||
|
||||
lti_verify_sourcedid($ltiinstance, $parsed);
|
||||
}
|
||||
|
||||
public function test_lti_ensure_url_is_https() {
|
||||
$this->assertEquals('https://moodle.org', lti_ensure_url_is_https('http://moodle.org'));
|
||||
$this->assertEquals('https://moodle.org', lti_ensure_url_is_https('moodle.org'));
|
||||
$this->assertEquals('https://moodle.org', lti_ensure_url_is_https('https://moodle.org'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user