8000 bug #38248 [HttpClient] Allow bearer token with colon (stephanvierkant) · symfony/symfony@caab0f1 · GitHub
[go: up one dir, main page]

Skip to content

Commit caab0f1

Browse files
bug #38248 [HttpClient] Allow bearer token with colon (stephanvierkant)
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [HttpClient] Allow bearer token with colon | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | n/a The JetBrains Hub (YouTrack API) creates tokens with a `perm:` prefix. This doesn't work right now, because HttpClient doesn't allow a colon in the bearer token. As far as I can see, there is no reason to disallow the use of the semicolon in the bearer token, so this PR fixes it. Example of a token: `perm:c3RlcGhhbg==.NTUtMw==.NiZw16agafhsQAShTvclhb78hyJh2H` Commits ------- 82ed1ec [HttpClient] Allow bearer token with colon
2 parents 9e7e2a8 + 82ed1ec commit caab0f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/HttpClient/HttpClientTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private static function prepareRequest(?string $method, ?string $url, array $opt
110110
throw new InvalidArgumentException(sprintf('Option "auth_basic" must be string or an array, "%s" given.', \gettype($options['auth_basic'])));
111111
}
112112

113-
if (isset($options['auth_bearer']) && (!\is_string($options['auth_bearer']) || !preg_match('{^[-._=~+/0-9a-zA-Z]++$}', $options['auth_bearer']))) {
113+
if (isset($options['auth_bearer']) && (!\is_string($options['auth_bearer']) || !preg_match('{^[-._=:~+/0-9a-zA-Z]++$}', $options['auth_bearer']))) {
114114
throw new InvalidArgumentException(sprintf('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, '.(\is_string($options['auth_bearer']) ? 'invalid string given.' : '"%s" given.'), \gettype($options['auth_bearer'])));
115115
}
116116

0 commit comments

Comments
 (0)
0