Skip to content

Commit d25ac26

Browse files
authored
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.
1 parent cee7e2a commit d25ac26

2 files changed

Lines changed: 396 additions & 1 deletion

File tree

src/Services/InfoProviderSystem/Providers/TMEProvider.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,13 @@ private function normalizeURL(string $url): string
280280
{
281281
//If a URL starts with // we assume that it is a relative URL and we add the protocol
282282
if (str_starts_with($url, '//')) {
283-
return 'https:' . $url;
283+
$url = 'https:' . $url;
284284
}
285285

286+
//Encode bare % signs that are not already part of a valid percent-encoded sequence
287+
//Fixes part numbers with % in them e.g. SMD0603-5K1-1%
288+
$url = preg_replace('/%(?![0-9A-Fa-f]{2})/', '%25', $url);
289+
286290
return $url;
287291
}
288292

0 commit comments

Comments
 (0)