mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-18 17:31:35 +00:00
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.
This commit is contained in:
parent
96da2b9f1f
commit
11d642dcc3
1 changed files with 5 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