Skip to content

Commit 6db2b87

Browse files
committed
oembed: getIframe - reorganize ifs
1 parent e8e626a commit 6db2b87

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/plugins/system/oembed/oembed.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,16 @@ function _getOembedIframe(oembed) {
4949
var $iframe = cheerio.load(html)('iframe');
5050
} catch (ex) {}
5151

52-
if ($iframe && $iframe.length === 2 && /<iframe>$/i.test(html)) {
53-
// Forgive mis-closed iFrame tag
54-
$iframe = $iframe.first();
55-
}
56-
57-
if ($iframe && $iframe.length === 1) {
58-
_iframe = fixOembedIframeAttributes($iframe[0].attribs);
59-
_iframe.placeholder = oembed.thumbnail_url;
52+
if ($iframe) {
53+
if ($iframe.length === 2 && /<iframe>$/i.test(html)) {
54+
// Forgive mis-closed iFrame tag
55+
$iframe = $iframe.first();
56+
}
57+
58+
if ($iframe.length === 1) {
59+
_iframe = fixOembedIframeAttributes($iframe[0].attribs);
60+
_iframe.placeholder = oembed.thumbnail_url;
61+
}
6062
}
6163

6264
// When oembed is in fact iframe from domain fallbacks on oEmbedError

0 commit comments

Comments
 (0)