?
Referenced as Pull Request for: # 9046
avatar kavadas
kavadas
1 Feb 2016

Steps to reproduce the issue

Create an article with text containing a URL with no protocol. A good example could be an embed of a dailymotion video which contains no protocol in the iframe src of the embed code. Then try to view a feed containing that article.

Expected result

The expected result is that the iframe src is not modified.

Actual result

Joomla tries to replace all relative links to absolute links in feeds. The function _relToAbs of JDocumentRenderer class considers incorrectly that URLs with no protocol are relative links and prepends the site's absolute URL to them.

System information (as much as possible)

Checked under Joomla! 3.4.8 and 3.5 BETA 2.

Additional comments

avatar kavadas kavadas - open - 1 Feb 2016
avatar brianteeman
brianteeman - comment - 1 Feb 2016

Not tested but what happens if it starts with //

avatar kavadas
kavadas - comment - 1 Feb 2016

It prepends the site's URL in that case. So the result src is http://yoursite.com///www.dailymotion.com/embed/video/x3okfgt .


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9039.

avatar brianteeman
brianteeman - comment - 1 Feb 2016

I have no problem with that embed in an article when using no-editor or
when using tinymce (after allowing iframe in the plugin)

On 1 February 2016 at 12:29, Lefteris Kavadas notifications@github.com
wrote:

It prepends the site's URL in that case. So the src attribute becomes

http://yoursite.com///www.dailymotion.com/embed/video/x3okfgt .

This comment was created with the J!Tracker Application
https://github.com/joomla/jissues at issues.joomla.org/joomla-cms/9039
https://issues.joomla.org/tracker/joomla-cms/9039.


Reply to this email directly or view it on GitHub
#9039 (comment).

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar kavadas
kavadas - comment - 1 Feb 2016

This is not related with the editor. The video is fine in the article page. The issue occurs in feed views where the JDocumentRenderer _relToAbs function is called. Try to view the RSS feed of the article's category and you should be able to reproduce the issue.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9039.

avatar brianteeman
brianteeman - comment - 1 Feb 2016

Sorry I missed that part of your instructions. Will test again later.
On 1 Feb 2016 4:31 pm, "Lefteris Kavadas" notifications@github.com wrote:

This is not related with the editor. The video is fine in the article
page. The issue occurs in feed views where the JDocumentRenderer _relToAbs
function is called. Try to view the RSS feed of the article's category and

you should be able to reproduce the issue.

This comment was created with the J!Tracker Application
https://github.com/joomla/jissues at issues.joomla.org/joomla-cms/9039
https://issues.joomla.org/tracker/joomla-cms/9039.


Reply to this email directly or view it on GitHub
#9039 (comment).

avatar brianteeman brianteeman - change - 1 Feb 2016
Status New Confirmed
avatar brianteeman
brianteeman - comment - 1 Feb 2016

I can confirm it now. If you have a fix please submit a pull request


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9039.

avatar ggppdk
ggppdk - comment - 2 Feb 2016

First, all embed urls if not having a protocol, should start with at least //

all these fail
src="//www.youtube.com/embed/..."
src="//player.vimeo.com/video/..."
src="//www.dailymotion.com/embed/video/..."

@brianteeman the fix is what you implied
that '//' should be detected as absolute and not as releative by the relToAbs function

https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/document/renderer.php#L86

$text = preg_replace("/(href|src)=\"(?!http|ftp|https|mailto|data)([^\"]*)\"/", "$1=\"$base\$2\"", $text);

should be added the detection of '//'
aka be add |\/\/

$text = preg_replace("/(href|src)=\"(?!http|ftp|https|mailto|data|\/\/)([^\"]*)\"/", "$1=\"$base\$2\"", $text);
avatar kavadas
kavadas - comment - 2 Feb 2016

The solution is indeed that simple. The regular expression should just ignore the URLs with no protocol. I have applied the exact same fix that @ggppdk provided and it's working for me.

avatar brianteeman
brianteeman - comment - 2 Feb 2016

Can you please create a Pull Request for this and then we can get this
fixed in the core

On 2 February 2016 at 08:51, Lefteris Kavadas notifications@github.com
wrote:

The solution is indeed that simple. The regular expression should just
ignore the URLs with no protocol. I have applied the exact same fix that
@ggppdk https://github.com/ggppdk provided and it's working for me.


Reply to this email directly or view it on GitHub
#9039 (comment).

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar wojsmol
wojsmol - comment - 2 Feb 2016

@brianteeman @kavadas Please test PR #9046

avatar brianteeman brianteeman - change - 2 Feb 2016
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2016-02-02 10:05:25
Closed_By brianteeman
avatar brianteeman
brianteeman - comment - 2 Feb 2016

Closing as we have a PR for testing #9046 Please test it so it can be accepted and merged


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9039.

avatar brianteeman brianteeman - close - 2 Feb 2016
avatar brianteeman brianteeman - close - 2 Feb 2016

Add a Comment

Login with GitHub to post a comment