Skip to content

Commit

Permalink
fix: Fixes endpoint correction to close #184. (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryasmi authored Jul 16, 2018
1 parent d6d987b commit b4e7ee4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/loader/lrs.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
defined('MOODLE_INTERNAL') || die();

function correct_endpoint($endpoint) {
$nostatements = trim($endpoint, 'statements');
$noslash = trim($nostatements, '/');
return $noslash;
$endswithstatements = substr($endpoint, -11) === "/statements";
if ($endswithstatements) {
return substr($endpoint, 0, -11);
}
return rtrim($endpoint, '/');
}

function load_transormed_events_to_lrs(array $config, array $transformedevents) {
Expand Down

0 comments on commit b4e7ee4

Please sign in to comment.