Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Posts: Fix detectImage post normalizer when there's an iframe with an empty src #11422

Merged
merged 1 commit into from Feb 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion client/lib/post-normalizer/rule-content-make-embeds-safe.js
Expand Up @@ -19,7 +19,8 @@ function doesNotNeedSandbox( iframe ) {
'kickstarter.com'
];

const iframeHost = iframe.src && url.parse( iframe.src ).hostname.toLowerCase();
const hostName = iframe.src && url.parse( iframe.src ).hostname;
const iframeHost = hostName && hostName.toLowerCase();

return some( trustedHosts, trustedHost => endsWith( '.' + iframeHost, '.' + trustedHost ) );
}
Expand Down
4 changes: 2 additions & 2 deletions client/lib/post-normalizer/utils.js
Expand Up @@ -138,8 +138,8 @@ export function iframeIsWhitelisted( iframe ) {
'facebook.com',
'embed.itunes.apple.com'
];

const iframeSrc = iframe.src && url.parse( iframe.src ).hostname.toLowerCase();
const hostName = iframe.src && url.parse( iframe.src ).hostname;
const iframeSrc = hostName && hostName.toLowerCase();
return some( iframeWhitelist, function( whitelistedSuffix ) {
return endsWith( '.' + iframeSrc, '.' + whitelistedSuffix );
} );
Expand Down