User tests: Successful: Unsuccessful:
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
Added handling of cases
style='...url("...")'
style='...url("...");'
style="...url('...');"
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 " '-->
<div id='rel-image5' style='background-image:url("relative/bg-home.jpg");'></div>
<div id='rel-image6' style="background-image:url('relative/bg-home.jpg');"></div>
<div id='rel-image7' style='background-image:url("relative/bg-home.jpg");'></div>
<div id='rel-image8' style="background-image:url('relative/bg-home.jpg');"></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("http://absolute_url_dom.org/absolute/bg-home.jpg");'></div>
<div id='bg-image12' style="background-image:url('http://absolute_url_dom.org/absolute/bg-home.jpg');"></div>
<div id='bg-image13' style='background-image:url("http://absolute_url_dom.org/absolute/bg-home.jpg");'></div>
<div id='bg-image14' style="background-image:url('http://absolute_url_dom.org/absolute/bg-home.jpg');"></div>
<div id='bg-image15' style='background-image:url("/absolute/bg-home.jpg");'></div>
<div id='bg-image16' style="background-image:url('/absolute/bg-home.jpg');"></div>
<div id='bg-image17' style='background-image:url("/absolute/bg-home.jpg");'></div>
<div id='bg-image18' style="background-image:url('/absolute/bg-home.jpg');"></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
Category | ⇒ | Plugins Router / SEF |
please visit
https://issues.joomla.org/tracker/joomla-cms/11266
and click "Test this" and the select "Tested successfuly" to mark a successful test
I have tested this item
Title |
|
I have tested this item
Works perfectly.
See results:
Status | New | ⇒ | Ready to Commit |
Labels |
Added:
?
|
Milestone |
Added: |
Category | Plugins Router / SEF | ⇒ | Plugins Front End Router / SEF |
Labels |
Removed:
?
|
Labels |
Added:
?
|
Milestone |
Removed: |
Milestone |
Added: |
Status | Ready to Commit | ⇒ | Pending |
Labels |
Milestone |
Removed: |
Labels |
Removed:
?
|
Milestone |
Removed: |
I have removed the redudant pipe character, if that case was ever encountered then HTML is already broken
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
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Thanks @ggppdk
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:
?
|
Works for me now. Thx