diff --git a/local/o365/classes/feature/coursesync/main.php b/local/o365/classes/feature/coursesync/main.php index 679a85e02..ea294e3ca 100644 --- a/local/o365/classes/feature/coursesync/main.php +++ b/local/o365/classes/feature/coursesync/main.php @@ -951,8 +951,8 @@ public function process_course_reset(stdClass $course, stdClass $o365object, boo $resetgroupnameprefix = 'disconnected-'; } $updatedmailnickname = $resetgroupnameprefix . utils::get_group_mail_alias($course); - if (strlen($updatedmailnickname) > 60) { - $updatedmailnickname = substr($updatedmailnickname, 0, 60); + if (strlen($updatedmailnickname) > 59) { + $updatedmailnickname = substr($updatedmailnickname, 0, 59); } $updatedexistinggroup = [ 'id' => $existinggroup['id'], diff --git a/local/o365/classes/feature/coursesync/utils.php b/local/o365/classes/feature/coursesync/utils.php index 432e9f984..4cdc09259 100644 --- a/local/o365/classes/feature/coursesync/utils.php +++ b/local/o365/classes/feature/coursesync/utils.php @@ -368,7 +368,7 @@ public static function get_group_mail_alias(stdClass $course) : string { $coursepart = static::clean_up_group_mail_alias($coursepart); - $coursepartmaxlength = 60 - strlen($groupmailaliasprefix) - strlen($groupmailaliassuffix); + $coursepartmaxlength = 59 - strlen($groupmailaliasprefix) - strlen($groupmailaliassuffix); if (strlen($coursepart) > $coursepartmaxlength) { $coursepart = substr($coursepart, 0, $coursepartmaxlength); }