Fixed Incorrect default media site definition for YouTube

JoshyPHP

Well-known member
Tested on XenForo 1.5 Beta 2 and Beta 3. In the default media site definition for YouTube, the Match URLs are set to the following:
Code:
youtube.com/watch?v={$id}
youtube.com/watch?*&v={$id}
youtube.com/v/{$id}
youtu.be/{$id}
youtube.com/*/u/*/{$id}youtube.com/embed/{$id}

It's missing a newline between the last two entries. It should be:
Code:
youtube.com/watch?v={$id}
youtube.com/watch?*&v={$id}
youtube.com/v/{$id}
youtu.be/{$id}
youtube.com/*/u/*/{$id}
youtube.com/embed/{$id}
 
Technically an upgrade but the definitions were reinstalled from my add-on using the query from XenForo_Install_Data_MySql::getData()['xf_bb_code_media_site']

The missing newline can be seen in the query:
Code:
INSERT INTO xf_bb_code_media_site
(media_site_id, site_title, site_url, match_urls, embed_html, match_is_regex)
VALUES
('facebook', 'Facebook', 'http://www.facebook.com', 'facebook.com/*video.php?v={$id:digits}\nfacebook.com/*photo.php?v={$id:digits}\nfacebook.com/*/videos/{$id:digits}', '<div class="fb-post" data-href="https://www.facebook.com/video.php?v={$id}" data-width="500"><div class="fb-xfbml-parse-ignore"><a href="https://www.facebook.com/video.php?v={$id}">https://www.facebook.com/video.php?v={$id}</a></div></div>', 0),
('vimeo', 'Vimeo', 'http://www.vimeo.com', 'vimeo.com/{$id:digits}\nvimeo.com/groups/*/videos/{$id:digits}', '<iframe src="https://player.vimeo.com/video/{$id}" width="500" height="300" frameborder="0"></iframe>', 0),
('youtube', 'YouTube', 'http://www.youtube.com', 'youtube.com/watch?v={$id}\nyoutube.com/watch?*&v={$id}\nyoutube.com/v/{$id}\nyoutu.be/{$id}\nyoutube.com/*/u/*/{$id}youtube.com/embed/{$id}', '<iframe width="500" height="300" src="https://www.youtube.com/embed/{$id}?wmode=opaque" frameborder="0" allowfullscreen></iframe>', 0),
('metacafe', 'Metacafe', 'http://www.metacafe.com', '#metacafe\\.com/watch/(?P<id>[a-z0-9-]+)(/|$)#siU', '<iframe src="http://www.metacafe.com/embed/{$id}/" width="500" height="300" allowFullScreen frameborder=0></iframe>', 1),
('dailymotion', 'Dailymotion', 'http://www.dailymotion.com', 'dailymotion.com/video/{$id:alphanum}', '<iframe frameborder="0" width="500" height="300" src="https://www.dailymotion.com/embed/video/{$id}?width=500&hideInfos=1"></iframe>', 0),
('liveleak', 'Liveleak', 'http://www.liveleak.com', 'liveleak.com/view?i={$id}', '<iframe width="500" height="300" src="http://www.liveleak.com/ll_embed?i={$id}" frameborder="0" allowfullscreen></iframe>', 0)
 
I have fixed this in the installer. It only applied to installs from 1.5 beta 2 (or something else that triggered it), so I won't be changing this after the fact. If you're affected, you should manually add the line break.
 
Top Bottom