Skip to content

Commit a3ec835

Browse files
committed
add mime checking, read local file
1 parent 5083192 commit a3ec835

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/compatibility/blocksy/index.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,11 @@ function( $file ) {
112112

113113
foreach ( $blocksy_static_files as $file ) {
114114
if ( isset( $file['url'] ) ) {
115-
$file_url = get_template_directory_uri() . $file['url'];
116-
$response = wp_remote_get( $file_url );
117-
if ( ! is_wp_error( $response ) ) {
118-
$styles .= wp_remote_retrieve_body( $response );
115+
$file_path = get_template_directory() . $file['url'];
116+
$mime = mime_content_type( $file_path );
117+
$is_valid_mime = $mime === 'text/css' || $mime === 'text/plain';
118+
if ( file_exists( $file_path ) && is_readable( $file_path ) && $is_valid_mime ) {
119+
$styles .= file_get_contents( $file_path );
119120
}
120121
}
121122
}

0 commit comments

Comments
 (0)