Skip to content

Commit

Permalink
Merge pull request #119 from juban/fix-118-correct-fallback-adapter-h…
Browse files Browse the repository at this point in the history
…andling

fix: Fix for FallbackAdapter not being handled correctly
  • Loading branch information
reganlawton authored Jun 30, 2022
2 parents 1571dd4 + 5d3110b commit 0042f6e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# oEmbed Changelog

## 2.2.1 - 2022-06-30

### Update
- Fix a side effect of #101 fix where the preview and embed will fallback to the default Craft site if no or invalid URL is provided (@juban)

## 2.2.0 - 2022-06-30

### Update
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "wrav/oembed",
"description": "A simple plugin to extract media information from websites, like youtube videos, twitter statuses or blog articles.",
"type": "craft-plugin",
"version": "2.2.0",
"version": "2.2.1",
"keywords": [
"craft",
"cms",
Expand Down
4 changes: 2 additions & 2 deletions src/services/OembedService.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public function embed($url, array $options = [])
try {
$dom = new DOMDocument;
$code = $media->getCode();
if (empty($code)) {
$code = Utils::iframe($media->url);
if (empty($code) && !($media instanceof FallbackAdapter)) {
$code = empty((string)$url) ? '' : Utils::iframe($media->url);
}
$dom->loadHTML($code);

Expand Down

0 comments on commit 0042f6e

Please sign in to comment.