mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-17 23:59:33 +00:00
fix(digikey): prevent crashing when no media is found for part
This commit is contained in:
parent
98b8c5b788
commit
0936f43326
1 changed files with 7 additions and 0 deletions
|
|
@ -311,6 +311,13 @@ class DigikeyProvider implements InfoProviderInterface
|
||||||
'auth_bearer' => $this->authTokenManager->getAlwaysValidTokenString(self::OAUTH_APP_NAME)
|
'auth_bearer' => $this->authTokenManager->getAlwaysValidTokenString(self::OAUTH_APP_NAME)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if ($response->getStatusCode() === 404) {
|
||||||
|
return [
|
||||||
|
'datasheets' => [],
|
||||||
|
'images' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
$media_array = $response->toArray();
|
$media_array = $response->toArray();
|
||||||
|
|
||||||
foreach ($media_array['MediaLinks'] as $media_link) {
|
foreach ($media_array['MediaLinks'] as $media_link) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue