fix media set data error. trim identifier
This commit is contained in:
parent
f633eeb529
commit
ca58dad9a2
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue