WPBuddy / largo

A WordPress framework for news websites. Finely-crafted by INN and expertly-honed and maintained by the technology team at WP Buddy.
http://largo.wpbuddy.co
GNU General Public License v2.0
171 stars 83 forks source link

largo_home_icon does not output images with relative or protocol-agnostic URLs. #1414

Open benlk opened 7 years ago

benlk commented 7 years ago

The regular expression here accepts the following:

https://therivardreport.com/wp-content/uploads/2016/06/Rivard-Report-Logo-Long-1-336x36.png
http://therivardreport.com/wp-content/uploads/2016/06/Rivard-Report-Logo-Long-1-336x36.png

but does not accept the following:

/wp-content/uploads/2016/06/Rivard-Report-Logo-Long-1-336x36.png
//therivardreport.com/wp-content/uploads/2016/06/Rivard-Report-Logo-Long-1-336x36.png

In cases where the saved URL is not accepted, the function silently outputs <i class="icon-home ' . esc_attr( $class ) . '"></i> where $class was passed to largo_home_icon()

Permanent fix

Change the regex. It's currently /^http(s)?\:\/\//

It should accept:

Temporary fix for sites affected:

Add the domain name and protocol back in.

rclations commented 7 years ago

Since this function is only used in /partials/nav-sticky.php, I think we can remove the function altogether and integrate the code directly into the template for simplicity.

Steps needed on this ticket:

benlk commented 5 years ago

Allow largo_home_icon to output images with relative or protocol-agnostic URLs