Skip to content

Commit

Permalink
Api: colon parameter can be separated by dot [Closes #21]
Browse files Browse the repository at this point in the history
  • Loading branch information
milo committed Jul 12, 2017
1 parent 7dadbf9 commit 20a6ead
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Github/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ protected function expandColonParameters($url, array $parameters, array $default
{
$parameters += $defaultParameters;

$url = preg_replace_callback('#(^|/):([^/]+)#', function($m) use ($url, & $parameters) {
$url = preg_replace_callback('#(^|/|\.):([^/.]+)#', function($m) use ($url, & $parameters) {
if (!isset($parameters[$m[2]])) {
throw new MissingParameterException("Missing parameter '$m[2]' for URL path '$url'.");
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Github/Api.expandColonParameters.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ test(function() {
':a/' => 'A?b=B',
'/:a/' => '/A?b=B',
'/:a/:b/c' => '/A/B/c',
'/:a.:b/c' => '/A.B/c',
'/:a...:b/c' => '/A...B/c',
];

foreach ($urls as $url => $expected) {
Expand Down

0 comments on commit 20a6ead

Please sign in to comment.