Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
rratsun committed Jan 30, 2023
1 parent 2da9e1e commit 9dff8cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Services/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ public function createEntity($data)
}

if (!empty($asset = $this->getEntityManager()->getRepository('Asset')->where(['fileId' => $attachment->get('id')])->findOne())) {
$asset = $this->readEntity($asset->get('id'));
if (property_exists($data, 'type') && $data->type !== $asset->get('type')) {
throw new BadRequest(sprintf($this->translate('assetExistWithOtherType', 'exceptions', 'Asset'), $data->url));
}
return $this->readEntity($asset->get('id'));
return $asset;
}

$data->name = $attachment->get('name');
Expand Down

0 comments on commit 9dff8cc

Please sign in to comment.