Skip to content

Commit

Permalink
Fix filename in Asset Proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlemke committed Dec 8, 2020
1 parent acea81a commit 05f44ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 11 additions & 4 deletions Classes/AssetSource/CantoAssetProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Neos\Flow\Annotations as Flow;
use Neos\Media\Domain\Model\AssetSource\AssetProxy\AssetProxyInterface;
use Neos\Media\Domain\Model\AssetSource\AssetProxy\HasRemoteOriginalInterface;
use Neos\Media\Domain\Model\AssetSource\AssetProxy\ProvidesOriginalUriInterface;
use Neos\Media\Domain\Model\AssetSource\AssetSourceInterface;
use Neos\Media\Domain\Model\ImportedAsset;
use Neos\Media\Domain\Repository\ImportedAssetRepository;
Expand All @@ -28,7 +29,7 @@
/**
*
*/
final class CantoAssetProxy implements AssetProxyInterface, HasRemoteOriginalInterface
final class CantoAssetProxy implements AssetProxyInterface, HasRemoteOriginalInterface, ProvidesOriginalUriInterface
{
/**
* @var CantoAssetSource
Expand Down Expand Up @@ -118,7 +119,7 @@ public static function fromJsonObject(stdClass $jsonObject, CantoAssetSource $as
$assetProxy->assetSource = $assetSource;
$assetProxy->identifier = $jsonObject->scheme . '|' . $jsonObject->id;
$assetProxy->label = $jsonObject->name;
$assetProxy->filename = Transliterator::urlize($jsonObject->name);
$assetProxy->filename = $jsonObject->name;
$assetProxy->lastModified = \DateTimeImmutable::createFromFormat('U', $jsonObject->time);
$assetProxy->fileSize = $jsonObject->size;
$assetProxy->mediaType = MediaTypes::getMediaTypeFromFilename($jsonObject->name);
Expand All @@ -131,8 +132,6 @@ public static function fromJsonObject(stdClass $jsonObject, CantoAssetSource $as
$assetProxy->previewUri = new Uri($jsonObject->url->directUrlPreview);
$assetProxy->originalUri = new Uri($jsonObject->url->directUrlOriginal);

# \Neos\Flow\var_dump($assetProxy->getMediaType());

return $assetProxy;
}

Expand Down Expand Up @@ -258,6 +257,14 @@ public function getImportStream()
return fopen($this->assetSource->getCantoClient()->directUri($this->identifier), 'rb');
}

/**
* @return UriInterface
*/
public function getOriginalUri(): UriInterface
{
return $this->assetSource->getCantoClient()->directUri($this->identifier);
}

/**
* @return string
*/
Expand Down
4 changes: 1 addition & 3 deletions Classes/AssetSource/CantoAssetProxyRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@
* information, please view the LICENSE file which was distributed with this
* source code.
*/

use Exception;
use Flownative\Canto\Exception\AccessToAssetDeniedException;
use Flownative\Canto\Exception\AssetNotFoundException;
use Flownative\Canto\Exception\AuthenticationFailedException;
use Flownative\Canto\Exception\ConnectionException;
use Flownative\Canto\Exception\MissingClientSecretException;
use Neos\Cache\Frontend\StringFrontend;
use Neos\Cache\Frontend\VariableFrontend;
use Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy;
Expand Down

0 comments on commit 05f44ea

Please sign in to comment.