Skip to content

Commit

Permalink
fix: truncate platform names to match db column size
Browse files Browse the repository at this point in the history
fixes #25
  • Loading branch information
chrispittman committed Jan 26, 2024
1 parent 11ca39f commit 4c92f40
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/PlatformCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ public static function createLTI1p2Platform(
if ($platform->created !== null) {
throw new \RuntimeException("Platform with this key already exists. Refusing to overwrite.");
}
$platform->name = $name;
if (strlen($name) > 50) {
$platform->name = substr($name, 0, 50);
} else {
$platform->name = $name;
}
$platform->secret = $secret;
$platform->enabled = true;
$platform->save();
Expand All @@ -45,7 +49,11 @@ public static function createLTI1p3Platform(
): void {
$platform = LTI\Platform::fromPlatformId($platform_id, $client_id, $deployment_id, $dataConnector);

$platform->name = $platform_id;
if (strlen($platform_id) > 50) {
$platform->name = substr($platform_id, 0, 50);
} else {
$platform->name = $platform_id;
}
$platform->authorizationServerId = $authorization_server_id;
$platform->jku = $jku;
$platform->authenticationUrl = $authentication_url;
Expand Down

0 comments on commit 4c92f40

Please sign in to comment.