Fix creating parts from TME if the SPN contains percent signs (#1337)

* Fix creating TME parts with percent signs in SPN

The SPN ends up in the URL, which later causes validation errors n the
form. Solved by encoding the percent sign.

* Add TME provider unit tests.
This commit is contained in:
Albert Koczy 2026-04-06 14:42:54 +02:00 committed by GitHub
parent cee7e2a077
commit d25ac2622e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 396 additions and 1 deletions

View file

@ -280,9 +280,13 @@ class TMEProvider implements InfoProviderInterface, URLHandlerInfoProviderInterf
{
//If a URL starts with // we assume that it is a relative URL and we add the protocol
if (str_starts_with($url, '//')) {
return 'https:' . $url;
$url = 'https:' . $url;
}
//Encode bare % signs that are not already part of a valid percent-encoded sequence
//Fixes part numbers with % in them e.g. SMD0603-5K1-1%
$url = preg_replace('/%(?![0-9A-Fa-f]{2})/', '%25', $url);
return $url;
}