Closed konklone closed 7 years ago
So, I note that I didn't look at all the appropriate code to gauge this without empirical testing. The original (1.04) code does try to determine whether the iframe
is a YouTube URL:
function IsYouTube_fed(url) {
var YouTubeLink_regEx = /^.*((youtu.be\/)|(\/v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
var match = url.match(YouTubeLink_regEx);
if (match != null && match.length > 0) {
return true;
} else {
return false;
}
}
The new code (2.0) has changed how this works:
function IsYouTube_fed(url) {
var YouTubeLink_regEx = /^(https?\:)?(\/\/)?(www\.)?(youtu\.be\/|youtube(\-nocookie)?\.([A-Za-z]{2,4}|[A-Za-z]{2,3}\.[A-Za-z]{2})\/)(watch|embed\/|vi?\/)?(\?vi?\=)?([^#\&\?\/]{11}).*$/;
if(YouTubeLink_regEx.test(url.toString())) {
return true;
}
else {
return false;
}
}
I'm not sure from this change what the bug was in 1.04, and what was addressed for 2.0. I'd need to see some technical explanation. I did a quick test of an <iframe>
tag to http://www.defense.gov
under 1.04 and 2.0 and neither broke, so I'm unable to empirically reproduce or confirm the fix without more details.
I believe this is now remedied. We upgraded to the current YouTube API version in v3.1.
The DAP code appears to identify all
<iframe>
tags as YouTube embeds, and rewrites their URLs fromhttp://
tohttps://
. This could break<iframe>
tags on a page that point to things other than YouTube embeds, and for which HTTPS is not supported.