-
Notifications
You must be signed in to change notification settings - Fork 219
Prepend CSS src with correct url scheme #10240
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: 0 B Total Size: 1.36 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @mikejolley, for the fix! I've left a comment below!
src/BlockTypes/ClassicTemplate.php
Outdated
wp_enqueue_style( $handle, $style['src'], $style['deps'], $style['version'], $style['media'] ); | ||
wp_enqueue_style( | ||
$handle, | ||
substr( $style['src'], 0, 2 ) === '//' ? 'https:' . $style['src'] : $style['src'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikejolley, shouldn't we also handle the case of no secure websites (HTTP)? This worked fine on my Jurassic Ninja test site but not on my local development site. Maybe there is a solution to include both protocols, or we can do a check as follows:
$protocol = strtolower( substr( $_SERVER[ "SERVER_PROTOCOL" ], 0, 5 ) ) == 'https' ? 'https' : 'http';
I've tested with $_SERVER['HTTPS']
, but it doesn't return the correct values on my local server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tarhi-saad I added set_url_scheme
. That takes care of it for us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added set_url_scheme. That takes care of it for us.
That's awesome! It works as expected! Let's 🚢 it!
a854ceb
to
7255336
Compare
Styles from themes (2023 for example) were not working in the editor because the src began with
//
. This fixes the issue by ensuring there is ahttps://
prefix.Fixes #10170
Screenshots
Testing
User Facing Testing
Changelog