fix media set data error. trim identifier

This commit is contained in:
buttle 2021-06-27 13:30:17 +02:00
parent f633eeb529
commit ca58dad9a2
1 changed files with 5 additions and 3 deletions

View File

@ -52,11 +52,12 @@ class SketchfabMediaIngester implements IngesterInterface
$errorStore->addError('o:identifier', 'No identifier specified');
return;
}
$url = 'https://sketchfab.com/oembed/?url=' . $data['o:identifier'];
$identifier = trim($data['o:identifier']);
$url = 'https://sketchfab.com/oembed/?url=' . $identifier;
$response = $this->client->setUri($url)->send();
if (!$response->isOk()) {
$errorStore->addError('o:source', sprintf(
'Cannot find model URL: '.$data['o:identifier'],
'Cannot find model URL: ' . $identifier,
$response->getReasonPhrase(),
$response->getStatusCode()
));
@ -68,8 +69,9 @@ class SketchfabMediaIngester implements IngesterInterface
if ($tempFile) {
$tempFile->mediaIngestFile($media, $request, $errorStore, false);
}
// Set the Media source and data.
$media->setSource($data['o:source']);
$media->setData($response_body, true));
$media->setData(json_decode($response->getBody(), true));
}
}