Closed (fixed)
Project:
Embedded Media Field
Version:
6.x-2.x-dev
Component:
Embedded Inline Media
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 May 2010 at 16:52 UTC
Updated:
30 May 2011 at 14:11 UTC
Jump to comment: Most recent file
Comments
Comment #1
dmleforce commentedI'm confused. I thought the point of the inline url was so we could just post youtube-url. Not html tags around it. I'm trying to make a family site & the less people have to worry about html the better. Posting the url don't work. Was I supposed to make a content type first? Because I've tried this span technique & also brackets. Nothing's working.
I also noticed it tells people they can embed videos from the following providers but don't list them. This is under input formats.
Comment #2
dmleforce commentedI found the answer to my problem here: http://drupal.org/node/524410. Even though it says if you pick none they'll all be picked you still have to pick. Plus conflicts with url filter so I had to rearrange.
FYI...I just wasted another couple of hours of my life creating a playlist at last fm so I could embed it only to learn you can't even view your playlist unless you pay $3/mo. I think their xml file shows the last few songs you listened to...not this playlist. I'm not sure about API's but I don't need one anyway. Linking to playlists isn't working for me...& I'm not even sure it would if I paid the $3/mo.
Comment #3
gdf commentedSorry for confusing you - my concern is with a somewhat niche need to wrap the displayed video in enough HTML that it can be formatted neatly as part of the page content. (For example, you can float an inline image, but you can't float the video without wrapping it in a <div> that floats.) Obviously I found an obscure workaround but I consider the problem a bug that might point to a deeper problem with the input filter.
Comment #4
David Stosik commentedSame problem here. I paste a Youtube URL in my body's CK Editor, then add a div around, to style the video (make it float, or clear, it depends). Then, my video won't be converted. If I put some spaces, like :
<p style="float:left"> http://www.youtube.com/watch?v=9RYpDYTZrYs </p>or remove any attributes to my p tag, like :
<p>http://www.youtube.com/watch?v=9RYpDYTZrYs</p>then the filter will replace the video URL with the proper HTML.
Shouldn't the URL be converted, even if it is surrounded by HTML tags ?
Regards,
David
Edit: this issue seems to be related to this line of code (eminline.module:69) :
$text = preg_replace_callback("`(<p>|<li>|<br\s*/?>|[ \n\r\t\(])((http://|https://)([a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_+*~#&=/;-]))([.,?!]*?)(?=(</p>|</li>|<br\s*/?>|[ \n\r\t\)]))`i", $callback($format), $text);Instead of looking for full HTML tags, wouldn't it be enough to look for closing and opening brackets, like this ?
$text = preg_replace_callback('`(?<=[\s\(>])((http://|https://)([a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_+*~#&=/;-]))([.,?!]*?)(?=[\s\<)])`i', $callback($format), $text);(I replaced double quotes by simple quotes, used a positive look behind at the begining, replaced ' \n\r\t' by only the entity \s, and removed the search for <p>, <li> or <br>, to, instead, match only a closing (or opening) bracket. I also needed to replace $match[2] by $match[1] in _eminline_url_parse_full_links() because a look-around is a 0-length entity.)
This totally works on my website. If agreed, I can provide a patch.
Edit2: just a little interesting fact : the regular expression used by eminline seems to be inspired (not to say copy-pasted) from the one used by Drupal's core URL input filter (which converts text web addresses into hyperlinks). And it is notable that the same issue can be raised there.
Comment #5
David Stosik commentedUp !
As you can see, Drupal core's URL filtering has changed a lot, which means the old regular expression (which is the one used here) was wrong : #877050: URL filter does not convert a link inside a div
Comment #6
gdf commentedMarking this as closed. Thanks to David Stosik for following through on it by creating a new issue where it would get looked at, and getting the right people to address it.
Comment #7
geerlingguy commentedThis has NOT been fixed in the Embedded Inline Media module... marking as active, retagging/labeling issue.
I'm also marking a couple other related issues as duplicates, in favor of this issue. I'll take a look at the regex (based on findings in #877050: URL filter does not convert a link inside a div and hopefully come up with a patch to fix this issue. It's annoying to have to try adding spaces around URLs when I want to center-align them or something like that...
Duplicates:
Comment #8
geerlingguy commentedUpdating title.
Comment #9
geerlingguy commentedAttached patch fixes the issue for me (borrowing regex from #877050: URL filter does not convert a link inside a div, and changing the array slot used for the URL match so it works correctly in the
_eminline_url_parse_full_links()function.Please apply this patch to eminline.module directly — I couldn't get CVS working at work, so I'm just posting a file patch, rather than a CVS patch from emfield's root directory.
Comment #10
geerlingguy commentedUm... Patch attached.
Comment #11
jannol commentedI am using tinymce with wysiwyg module
My users are allowed to use tinymce for content and they paste video links in the rich editor.
If they do not watch out where they insert they video link it might end up inside tags that have styles.
I am not sure whats causing the problem but it seems like that the patch in #10 is to blame by placing the output div inside its parent tag as e.g.
gives
Comment #12
geerlingguy commented@jannol - are you sure you've applied the patch in #10 correctly? I have the same format, but I haven't had trouble getting the video to appear correctly...
Comment #13
jannol commentedYes I am sure but I must have something configured or hacked that breaks cause I tested on one of my almost clean testserver and I do not get the same issue there. My install of the main server is not exactly "clean" :-D
However, in the meantime I simply modded the matching abs. url to
Comment #14
tribsel commentedapplied patch in #10 and it works
Comment #15
geerlingguy commented@tribsel & @jannol - then, do you think we could mark this as RTBC, then follow up with trying to help jannol with the specific problem on the 'unclean' server?
Comment #16
jannol commentedI will not have time to dig into this issue on my unclean server at this moment, as for me, do not spend any further time on my problem.
RTBC seems to be ok since it works and no other issues reported.
BTW, Good work geerlingguy
Comment #17
geerlingguy commentedNice!
Comment #18
travisc commentedtested as working on 6.x-2.4, please mark as ready to be committed
Comment #19
geerlingguy commentedPatches always made against -dev branch...
Comment #20
bewhy commentedalso applied successfully . . . thanks a LOT
If i'm able to weigh in, i think this is critical enough to warrant a new release
Comment #21
geerlingguy commentedIt needs to be committed first, before it will appear in a new release... ;-)
This should also apply against 3.x, I'm pretty sure, as the Embedded Inline Media part of the module is nearly identical.
Comment #22
brightboldI am finding the patch in #10 solves the problem in Firefox and Chrome (yay!) but not in IE. Have other people tested in IE and found this to work? (I hate to un-rtbc it if it's just something I've done wrong, but I can replicate this on two different sites.)
With the patch applied, Firefox shows the embedded video they way it should. Internet Explorer creates the div for the video at the appropriate size, and using Developer Tools I can see the object tag inside the div (as opposed to the pre-patch behavior of just displaying the URL.) However, the video never loads. The page continues to attempt to download the "1 item remaining" for all eternity, without success.
Can other people speak to whether this patch solves the problem for you in IE?
I would really love to see this get fixed, so thanks @geerlingguy for the patch!
Comment #23
brightboldForgot to mention that if you click in the blank area where the video should be, you're taken to the YouTube source page to view the video. (Also, the new regex changes seem to mean that you can no longer just add spaces around the URL and get it to display - which I'm sure makes perfect sense to the folks with the dev chops to have troubleshot this issue in the first place!)
Comment #24
geerlingguy commentedI'll try to take a look at this. On three sites on which I'm using the patch, IE users are seeing videos perfectly. I wonder if there might be another theme issue on your sites, or a conflicting filter. Could you post exactly what code you have on your site (both when editing the node, and when it renders)? Or, better yet, a live link to the page in question?
Comment #25
brightbold@geerlingguy - Sorry for the delayed response; I wasn't staying on top of my issues during DrupalCon.
Thanks for your response. In that case it sounds like it's just me but if you are offering to help troubleshoot that would be awesome. Here's one example: http://thepushback.org/gilmore-girls-life-of-a-former-teen-mom
Oddly, on one site, video that was embedded before I upgraded to emfield 2.x has worked all along; only the video embedded after the providers were pulled out is broken (this could a coincidence—I had been thinking maybe those pages already had spaces around the URLs and the new ones didn't, but those pages also work fine in IE while the newer ones don't.)
Let me know if there's any other information I can provide or what other ideas you have for how I can troubleshoot. Thanks for your help!
Comment #26
geerlingguy commentedSetting back status... I will take a look at @BrightBold's site soon, if I get a chance, but I'm using this patch on three sites now, without issue, on any browser (browser-related issues wouldn't be affected by this patch, anyways, though, since the patch fixes the regex in drupal's filter system, which runs on the server...
Comment #27
oriol_e9gI can confirm that the patch #10 solves the problem.
without the patch:
with the patch:
Comment #28
aaron commentedawesome, thanks @geerlingguy! committed to all branches in 6.x.
Comment #29
geerlingguy commentedSweeeet! Thank you, @aaron... one less patch to worry about on my sites!
Comment #30
brightboldThanks @geerlingguy (and @aaron for committing!) — I can confirm that this patch solves the problem (once I also fixed my input filter order, oops!)