liip / bootstrap-blocks-wordpress-plugin

Bootstrap Gutenberg Blocks for WordPress
https://wordpress.org/plugins/wp-bootstrap-blocks/
280 stars 60 forks source link

Bug with url encoded paths #26

Closed stephenbeckett closed 4 years ago

stephenbeckett commented 4 years ago

Hello,

I think that line 151 of src/class-wp-bootstrap-blocks.php needs amending to something like: $index_version = isset( $index_asset[‘version’] ) ? $index_asset[‘version’] : filemtime( urldecode($index_path) );

To fix this bug that seems to occur for url encoded paths (containing e.g. space/%20): Warning: filemtime(): stat failed for /Users/xxxxxx/Local%20Sites/xxxxxx/app/public/wp-content/plugins/wp-bootstrap-blocks/build/index.js in /Users/xxxxxx/Local Sites/xxxxxx/app/public/wp-content/plugins/wp-bootstrap-blocks/src/class-wp-bootstrap-blocks.php on line 151

Cheers!

tschortsch commented 4 years ago

Hi @stephenbeckett. Thanks for the bugreport! You're totally right. I think the main problem here is that the asset_dir variable shouldn't be escped with esc_url() at all. I just pushed a fix for this: https://github.com/liip/bootstrap-blocks-wordpress-plugin/commit/b92d20c45d9ebd13e07e57e7960aa97b44385194.

I'll try to release a new version of the plugin with this fix as soon as possible (probably next week).

tschortsch commented 4 years ago

This is fixed in v2.0.0 of the plugin (see: https://github.com/liip/bootstrap-blocks-wordpress-plugin/releases/tag/2.0.0)