Skip to content

Commit 52b21be

Browse files
committed
Blogs: Also allow blog.jquery.com img on blog.jquerymobile.com/wp-admin
Follows-up f34334e. To avoid errors while editing.
1 parent f34334e commit 52b21be

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

plugins/jquery-filters.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,20 @@
108108

109109
$policy = apply_filters( 'jq_content_security_policy', $policy );
110110

111-
if ( is_admin() ) {
112-
// wp-admin (as used by blogs) requires inline scripts, inline styles,
113-
// and workers from blob: URLs
114-
$policy[ 'script-src' ] = "'self' 'unsafe-inline' blob: code.jquery.com";
115-
$policy[ 'style-src' ] = "'self' 'unsafe-inline' code.jquery.com";
116-
} elseif ( get_option( 'jquery_is_blog' ) ) {
111+
if ( get_option( 'jquery_is_blog' ) ) {
117112
// Allow <style> in blog posts
118113
$policy[ 'style-src' ] = "'self' 'unsafe-inline' code.jquery.com";
119114
// Allow re-use of blog post attachments between blog.jquery.com, blog.jqueryui.com, and blog.jquerymobile.com
120115
$policy[ 'img-src' ] = "'self' data: secure.gravatar.com code.jquery.com blog.jquery.com blog.jqueryui.com blog.jquerymobile.com";
116+
117+
// wp-admin requires inline scripts, inline styles, and workers from blob: URLs
118+
if ( is_admin() ) {
119+
$policy[ 'script-src' ] = "'self' 'unsafe-inline' blob: code.jquery.com";
120+
}
121+
} elseif ( is_admin() ) {
122+
// wp-admin (as used by blogs) requires inline scripts, inline styles, and workers from blob: URLs
123+
$policy[ 'script-src' ] = "'self' 'unsafe-inline' blob: code.jquery.com";
124+
$policy[ 'style-src' ] = "'self' 'unsafe-inline' code.jquery.com";
121125
}
122126

123127
$policy_string = '';

0 commit comments

Comments
 (0)