mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-24 11:09:34 +00:00
Added comment explaining the json_decode in getRealDatasheetUrl
This commit is contained in:
parent
0a92f2ed6e
commit
ff40162267
1 changed files with 2 additions and 0 deletions
|
|
@ -103,6 +103,8 @@ class LCSCProvider implements InfoProviderInterface
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
if (preg_match('/(pdfUrl): ?("[^"]+wmsc\.lcsc\.com[^"]+\.pdf")/', $response->getContent(), $matches) > 0) {
|
if (preg_match('/(pdfUrl): ?("[^"]+wmsc\.lcsc\.com[^"]+\.pdf")/', $response->getContent(), $matches) > 0) {
|
||||||
|
//HACKY: The URL string contains escaped characters like \u002F, etc. To decode it, the JSON decoding is reused
|
||||||
|
//See https://github.com/Part-DB/Part-DB-server/pull/582#issuecomment-2033125934
|
||||||
$jsonObj = json_decode('{"' . $matches[1] . '": ' . $matches[2] . '}');
|
$jsonObj = json_decode('{"' . $matches[1] . '": ' . $matches[2] . '}');
|
||||||
$url = $jsonObj->pdfUrl;
|
$url = $jsonObj->pdfUrl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue