Skip to content

Commit

Permalink
Merge pull request #32 from oat-sa/fix/TR-890/fix_incorrect_score_url
Browse files Browse the repository at this point in the history
fix: buildEndpointUrl remove too much when trimming line item URL
  • Loading branch information
m-lagarde committed Apr 23, 2021
2 parents 2d0c7c4 + 3c91c5c commit 0f976dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

0.6.1
-----

* Fixed buildEndpointUrl of ScoreServiceClient when trimming line item URL provided by AGS claims

0.6.0
-----

Expand Down
8 changes: 6 additions & 2 deletions src/Service/Score/Client/ScoreServiceClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,13 @@ public function publish(
private function buildEndpointUrl(string $lineItemUrl): string
{
$parsedUrl = parse_url($lineItemUrl);

$parsedUrl['path'] = rtrim($parsedUrl['path'], '/');
$parsedUrl['path'] = rtrim($parsedUrl['path'], '/lineitem');

$endStringToRemove = '/lineitem';

if (str_ends_with($parsedUrl['path'], $endStringToRemove)) {
$parsedUrl['path'] = substr($parsedUrl['path'], 0, -1 * strlen($endStringToRemove));
}

$username = $parsedUrl['user'] ?? '';
$password = isset($parsedUrl['pass']) ? ':' . $parsedUrl['pass'] : '';
Expand Down

0 comments on commit 0f976dc

Please sign in to comment.