diff options
author | Corey Hulen <corey@hulen.com> | 2015-12-09 09:52:13 -0800 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-12-09 09:52:13 -0800 |
commit | d81496ffcff121db448bf81e6aeb8e191cf408f2 (patch) | |
tree | 71061efc8f03be4ac55a1bb2db2fae01c51879ee /web/react/components/post_body.jsx | |
parent | 84aa572f67cc41d59690a73f080d0f6c81be4ae0 (diff) | |
parent | 699230bb3f14a55acbf49a678df7fd87f865ae5b (diff) | |
download | chat-d81496ffcff121db448bf81e6aeb8e191cf408f2.tar.gz chat-d81496ffcff121db448bf81e6aeb8e191cf408f2.tar.bz2 chat-d81496ffcff121db448bf81e6aeb8e191cf408f2.zip |
Merge pull request #1678 from mattermost/plt-1402
PLT-1402 Fix OEmbeds when switching channel, vine/soundcloud heights, and yout…
Diffstat (limited to 'web/react/components/post_body.jsx')
-rw-r--r-- | web/react/components/post_body.jsx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx index 35a7727e9..dcbe56399 100644 --- a/web/react/components/post_body.jsx +++ b/web/react/components/post_body.jsx @@ -214,14 +214,14 @@ export default class PostBody extends React.Component { } createYoutubeEmbed(link) { - const ytRegex = /.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|watch\?(?:[a-zA-Z-_]+=[a-zA-Z0-9-_]+&)+v=)([^#\&\?]*).*/; + const ytRegex = /(?:http|https):\/\/(?:www\.)?(?:(?:youtube\.com\/(?:(?:v\/)|(\/u\/\w\/)|(?:(?:watch|embed\/watch)(?:\/|.*v=))|(?:embed\/)|(?:user\/[^\/]+\/u\/[0-9]\/)))|(?:youtu\.be\/))([^#\&\?]*)/; const match = link.trim().match(ytRegex); - if (!match || match[1].length !== 11) { + if (!match || match[2].length !== 11) { return null; } - const youtubeId = match[1]; + const youtubeId = match[2]; const time = this.handleYoutubeTime(link); function onClick(e) { |