-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use IFRAME
to display HTML responses for REST API storage request failures in Site Health test
#1849
Use IFRAME
to display HTML responses for REST API storage request failures in Site Health test
#1849
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## trunk #1849 +/- ##
==========================================
+ Coverage 65.97% 66.30% +0.33%
==========================================
Files 88 88
Lines 6895 6963 +68
==========================================
+ Hits 4549 4617 +68
Misses 2346 2346
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
$result['description'] .= '<details><summary>' . esc_html__( 'Raw response:', 'optimization-detective' ) . '</summary><pre style="white-space: pre-wrap">' . esc_html( $body ) . '</pre></details>'; | ||
$result['description'] .= '<details><summary>' . esc_html__( 'Raw response:', 'optimization-detective' ) . '</summary>'; | ||
|
||
if ( isset( $header ) && 'text/html' === $header ) { |
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.
This will account for headers values like text/html; charset=utf-8
and application/xml+xhtml
:
if ( isset( $header ) && 'text/html' === $header ) { | |
if ( is_string( $header ) && str_contains( $header, 'html' ) { |
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.
Aside: $header
will always be set and never be null
so the use of isset()
probably was unnecessary, right?
I found the size of the So in 6685c7a I increased the size: |
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.
Looks good!
5c161b2
to
0307bb5
Compare
0307bb5
to
c748645
Compare
IFRAME
to display HTML responses for REST API storage request failures in Site Health test
Summary
Fixes #1828
Relevant technical choices
text/html
type, use an IFRAME combined withsandbox
andattributes.seamless
wp_admin_notice
withwp_get_admin_notice
to whitelist the used IFRAME and posts parameters using wp_kses function.Screenshots or screencast