1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-04 07:52:48 +02:00

MDL-62316 OAuth 2: Only guess image if base URL set.

If you added an OAuth 2 service with no base URL guess_image() would try to
parse this empty value looking for a favicon.ico.  We now check if the base
URL is empty beforehand and skip this if so.
This commit is contained in:
Leon Stringer 2018-05-22 17:43:05 +01:00
parent 22744b745b
commit 02cc1ecd77

@ -349,7 +349,7 @@ class api {
* @param \core\oauth2\issuer $issuer The desired OAuth issuer
*/
protected static function guess_image($issuer) {
if (empty($issuer->get('image'))) {
if (empty($issuer->get('image')) && !empty($issuer->get('baseurl'))) {
$baseurl = parse_url($issuer->get('baseurl'));
$imageurl = $baseurl['scheme'] . '://' . $baseurl['host'] . '/favicon.ico';
$issuer->set('image', $imageurl);