Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
embed: incorrect title and filename
Browse files Browse the repository at this point in the history
Fixes #660
  • Loading branch information
wellingguzman committed Dec 17, 2018
1 parent 831d112 commit 2a7b754
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/core/Directus/Application/CoreServicesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ protected function getEmitter()
$type = ArrayUtils::get($dataInfo, 'type', ArrayUtils::get($data, 'type'));

if (strpos($type, 'embed/') === 0) {
$recordData = $files->saveEmbedData($dataInfo);
$recordData = $files->saveEmbedData(array_merge($dataInfo, ArrayUtils::pick($data, ['filename'])));
} else {
$recordData = $files->saveData($payload['data'], $payload['filename'], $replace);
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/Directus/Embed/Provider/VimeoProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function fetchInfo($videoID)
{
$info = [];

$info['title'] = 'Unable to retrieve Vimeo title';
$info['title'] = null;
$info['filesize'] = 0;
$info['width'] = 560;
$info['height'] = 540;
Expand Down
2 changes: 1 addition & 1 deletion src/core/Directus/Embed/Provider/YoutubeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected function fetchInfo($videoID)
{
$info = [];

$info['title'] = 'Unable to retrieve YouTube title';
$info['title'] = null;
$info['filesize'] = 0;
$info['height'] = 340;
$info['width'] = 560;
Expand Down
5 changes: 1 addition & 4 deletions src/core/Directus/Filesystem/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,8 @@ public function saveEmbedData(array $fileInfo)
}

$fileName = isset($fileInfo['filename']) ? $fileInfo['filename'] : md5(time()) . '.jpg';
$imageData = $this->saveData($fileInfo['data'], $fileName);

return array_merge($imageData, $fileInfo, [
'filename' => $fileName
]);
return $this->saveData($fileInfo['data'], $fileName);
}

/**
Expand Down

0 comments on commit 2a7b754

Please sign in to comment.