? Success

User tests: Successful: Unsuccessful:

avatar ggppdk
ggppdk
23 Jul 2016

Pull Request for Issue #11264 and issue: #7267

The SEF plugin attempts to make inline background url paths absolute but adding / or /jfolder/ to them

Example of broken cases:

<div id='bg-image' style='background-image:url(database/bg-home.jpg);'></div>
<div id='bg-image4' style='background-image:url("database/bg-home.jpg");'></div>
<div id='bg-image5' style='background-image:url(&34;database/bg-home.jpg&34;);'></div>

the above will become:

<div id='bg-image' style="background-image: url('/jfolder/database/bg-home.jpg');'></div>
<div id='bg-image4' style="background-image: url('/jfolder/database/bg-home.jpg');'></div>
<div id='bg-image5' style="background-image: url('/jfolder/&34;database/bg-home.jpg');'></div>

which are obviously broken

Summary of Changes

Added handling of cases

style='...url("...")'
style='...url(&#34;...&#34;);'
style="...url(&#39;...&#39;);"

Testing Instructions

Apply patch and at the bottom of index.php of protostar (just before </body> TAG) add:

<!-- RELATIVE urls (this must be replaced) -->
        <!-- WITHOUT quotes: url() -->
    <div id='rel-image1' style='background-image:url(relative/bg-home.jpg);'></div>
    <div id='rel-image2' style="background-image:url(relative/bg-home.jpg);"></div>
    <div id='rel-image1a' style='color:red; background-image:url(relative/bg-home.jpg);'></div>
    <div id='rel-image2a' style="color:red; background-image:url(relative/bg-home.jpg);"></div>

        <!-- WITH single/double quotes:  url("") or url('') -->
    <div id='rel-image3' style="background-image:url('relative/bg-home.jpg');"></div>
    <div id='rel-image4' style='background-image:url("relative/bg-home.jpg");'></div>
    <div id='rel-image3a' style="color:red; background-image:url('relative/bg-home.jpg');"></div>
    <div id='rel-image4a' style='color:red; background-image:url("relative/bg-home.jpg");'></div>    

        <!-- Single/double quotes written as special characters &#34; &#39;-->
    <div id='rel-image5' style='background-image:url(&#34;relative/bg-home.jpg&#34;);'></div>
    <div id='rel-image6' style="background-image:url(&#39;relative/bg-home.jpg&#39;);"></div>
    <div id='rel-image7' style='background-image:url(&#034;relative/bg-home.jpg&#034;);'></div>
    <div id='rel-image8' style="background-image:url(&#039;relative/bg-home.jpg&#039;);"></div>


<!-- ABSOLUTE urls (plugin must NOT replace) -->
        <!-- WITHOUT quotes: url() -->
    <div id='abs-image1' style='background-image:url(http://absolute_url_dom.org/absolute/bg-home.jpg);'></div>
    <div id='abs-image2' style="background-image:url(http://absolute_url_dom.org/absolute/bg-home.jpg);"></div>
    <div id='abs-image3' style='background-image:url(/absolute/bg-home.jpg);'></div>
    <div id='abs-image4' style="background-image:url(/absolute/bg-home.jpg);"></div>

        <!-- WITH single/double quotes:  url("") or url('') and ABSOLUTE urls-->        
    <div id='abs-image7' style="background-image:url('http://absolute_url_dom.org/absolute/bg-home.jpg');"></div>
    <div id='abs-image8' style='background-image:url("http://absolute_url_dom.org/absolute/bg-home.jpg");'></div>
    <div id='abs-image9' style="background-image:url('/absolute/bg-home.jpg');"></div>
    <div id='abs-image10' style='background-image:url("/absolute/bg-home.jpg");'></div>

        <!-- Case with single/double quotes written as special characters for ABSOLUTE URLs -->
    <div id='bg-image11' style='background-image:url(&#034;http://absolute_url_dom.org/absolute/bg-home.jpg&#034;);'></div>
    <div id='bg-image12' style="background-image:url(&#039;http://absolute_url_dom.org/absolute/bg-home.jpg&#039;);"></div>
    <div id='bg-image13' style='background-image:url(&#34;http://absolute_url_dom.org/absolute/bg-home.jpg&#34;);'></div>
    <div id='bg-image14' style="background-image:url(&#39;http://absolute_url_dom.org/absolute/bg-home.jpg&#39;);"></div>
    <div id='bg-image15' style='background-image:url(&#034;/absolute/bg-home.jpg&#034;);'></div>
    <div id='bg-image16' style="background-image:url(&#039;/absolute/bg-home.jpg&#039;);"></div>
    <div id='bg-image17' style='background-image:url(&#34;/absolute/bg-home.jpg&#34;);'></div>
    <div id='bg-image18' style="background-image:url(&#39;/absolute/bg-home.jpg&#39;);"></div>

after patch the will be no broken HTML

PS: there is almost zero performance impact to the regexp , we simply capture the quotes and use them, the regexp has no other changes

avatar ggppdk ggppdk - open - 23 Jul 2016
avatar brianteeman brianteeman - change - 23 Jul 2016
Category Plugins Router / SEF
avatar HLeithner
HLeithner - comment - 26 Jul 2016

Works for me now. Thx

avatar ggppdk
ggppdk - comment - 26 Jul 2016

@HLeithner

please visit
https://issues.joomla.org/tracker/joomla-cms/11266

and click "Test this" and the select "Tested successfuly" to mark a successful test

avatar HLeithner HLeithner - test_item - 26 Jul 2016 - Tested successfully
avatar HLeithner
HLeithner - comment - 26 Jul 2016

I have tested this item successfully on ff76cd8


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

avatar ggppdk ggppdk - change - 30 Jul 2016
Title
Fix SEF plugin some times breaking HTML while trying to make inline background url paths absolute
Fix SEF plugin breaking HTML while trying to make inline background url paths absolute
avatar hardiktailored hardiktailored - test_item - 1 Aug 2016 - Tested successfully
avatar hardiktailored
hardiktailored - comment - 1 Aug 2016

I have tested this item successfully on ff76cd8

Works perfectly.


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

avatar hardiktailored
hardiktailored - comment - 1 Aug 2016

See results:

Before Patch:
screen shot 2016-08-01 at 06 18 37

After Patch:
(1)
screen shot 2016-08-01 at 06 18 56

(2)
screen shot 2016-08-01 at 06 19 06


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

avatar brianteeman brianteeman - change - 1 Aug 2016
Status New Ready to Commit
avatar brianteeman
brianteeman - comment - 1 Aug 2016

Rtc


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

avatar ggppdk
ggppdk - comment - 3 Aug 2016

No longer RTC, it needs retesting, since i added handling of:

style='background-image:url(&#34;...&#34;);'
style="background-image:url(&#39;...&#39;);"

to fix issue: #7267

correct_replacements

avatar brianteeman brianteeman - change - 2 Sep 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 2 Sep 2016
Milestone Added:
avatar joomla-cms-bot joomla-cms-bot - change - 2 Sep 2016
Category Plugins Router / SEF Plugins Front End Router / SEF
avatar wilsonge wilsonge - change - 2 Sep 2016
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 2 Sep 2016
Labels Added: ?
avatar wilsonge wilsonge - change - 2 Sep 2016
Milestone Removed:
avatar wilsonge wilsonge - change - 2 Sep 2016
Milestone Added:
avatar wilsonge wilsonge - change - 2 Sep 2016
Status Ready to Commit Pending
Labels
avatar wilsonge wilsonge - change - 2 Sep 2016
Milestone Removed:
avatar wilsonge wilsonge - change - 2 Sep 2016
Labels Removed: ?
avatar wilsonge wilsonge - change - 2 Sep 2016
Milestone Removed:
avatar ggppdk ggppdk - change - 11 Dec 2016
The description was changed
avatar ggppdk
ggppdk - comment - 11 Dec 2016

I have removed the redudant pipe character, if that case was ever encountered then HTML is already broken

avatar ggppdk
ggppdk - comment - 20 Jan 2017

I have removed the redudant $6 replacement of the 6th capturing block, as it does not the 6th capturing block, does not exist.
It should continue to work as before

avatar csthomas
csthomas - comment - 20 Jan 2017

I have tested this item successfully on b616e60


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

avatar csthomas csthomas - test_item - 20 Jan 2017 - Tested successfully
avatar dgt41
dgt41 - comment - 20 Jan 2017

I have tested this item successfully on b616e60


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

avatar dgt41 dgt41 - change - 20 Jan 2017
The description was changed
Status Pending Ready to Commit
avatar joomla-cms-bot joomla-cms-bot - edited - 20 Jan 2017
avatar dgt41 dgt41 - test_item - 20 Jan 2017 - Tested successfully
avatar dgt41
dgt41 - comment - 20 Jan 2017

RTC

Thanks @ggppdk


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

avatar rdeutz rdeutz - change - 20 Jan 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-01-20 20:24:39
Closed_By rdeutz
Labels Added: ?
avatar rdeutz rdeutz - close - 20 Jan 2017
avatar rdeutz rdeutz - merge - 20 Jan 2017

Add a Comment

Login with GitHub to post a comment