Skip to content

Commit

Permalink
Fix #160
Browse files Browse the repository at this point in the history
  • Loading branch information
ttempleton committed Feb 17, 2021
1 parent 42ee225 commit 0b77296
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### Changed
- The embedded asset caching added in Embedded Assets 2.3.0 now uses the Craft data cache, rather than manual saving of files within `storage/runtime/assets/embeddedassets` (thanks @johndwells)

### Fixed
- Fixed a potential error when trying to get the `EmbeddedAsset` model of an asset that wasn't an embedded asset

## 2.4.5 - 2020-12-29

### Changed
Expand Down
8 changes: 7 additions & 1 deletion src/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,13 @@ static function() use($asset) {
},
0);

return Json::decodeIfJson($contents);
try {
$contents = Json::decode($contents);
} catch (\Throwable $e) {
throw new Exception('Tried to get the contents of a non-embedded asset');
}

return $contents;
}

/**
Expand Down

0 comments on commit 0b77296

Please sign in to comment.