mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-11 15:32:12 +00:00
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:
parent
cee7e2a077
commit
d25ac2622e
2 changed files with 396 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue