Partial fix youtube link autoembed bug

swatme

Well-known member
Theres a bug in xf youtube autoembed with original url
"Auto-embed media, and add a link to the content within this BB code"



example:
user post youtube video url

Then xf will automatically convert that into embed with the original link below it.

Example:

zzz.youtube.com/watch?v=1D4lw59ledI <--- note i change the www to zzz just to show the original link example

Then

when you quote the post, it will redouble the video embed
due to the original link posted in the message will also be converted again to auto embed.
 
Confirmed, though I think this is working by design. I can't imagine why someone wants it to behave like this, perhaps this could be solved by having the <a href> rendered output include some micro data telling xenforo not to auto parse it or something.
Screen shot 2011-11-04 at 4.48.36 PM.webp
 
I don't see any way of fully preventing unfortunately, short of just removing that part of the option. We adjusted the auto-embedding to be run on links where the text is the same as the URL. Thus there's really no way to distinguish this URL.

The workaround is to make the text of the link be different from the URL. For example:
Code:
[url={$url}]View: {$url}[/url]
 
I don't see any way of fully preventing unfortunately, short of just removing that part of the option. We adjusted the auto-embedding to be run on links where the text is the same as the URL. Thus there's really no way to distinguish this URL.

The workaround is to make the text of the link be different from the URL. For example:
Code:
[url={$url}]View: {$url}[/url]

agree.
just imagine a 10 part series youtube video posted in a single message
then each one will quote it :D
youtube flash videos makes your browser crawl to its feet.

so next version would be best to fix it by changing the textlink name
so that it will not be captured by autoembed
 
I added a comment about how this could happen and changed the default link example to:
Code:
[i][size=2][url={$url}]View: {$url}[/url][/size][/i]
Which won't trigger the issue.
 
I added a comment about how this could happen and changed the default link example to:
Code:
[i][size=2][url={$url}]View: {$url}[/url][/size][/i]
Which won't trigger the issue.


Are you sure that fix is working right? I just added it and take a look at this picture how the URL gets displayed. The link has been listed 2 times and there a visible ending URL BBCode bracket still left open

utube.webp
 
Sorry, ignore that above. It must have been a cache thing going on. I just tried disabling and re-enabling that option after changing the code and it appears to be working OK now. You must have to turn embed link off, then back on again for the change to kick in.
 
Na
Sorry, ignore that above. It must have been a cache thing going on. I just tried disabling and re-enabling that option after changing the code and it appears to be working OK now. You must have to turn embed link off, then back on again for the change to kick in.
Turning it off and on again just reverted the original code, at least it did for me.
 
Are you saying...turn it off and back on again?

roy.jpg
 
Turns out the {$url} replacement was for [url]{$url}[/url], so I removed that and also fixed an issue with the default value for the field.
 
Can anyone confirm that quoted auto-embed links don't embed in XF 1.1.0 RC1?
That wasn't the fix. The fix was to change the default embed code and to document this happening. The code I posted is basically the way you should work around it.
 
Top Bottom