Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Release: 8.5.1 (#7212)
Browse files Browse the repository at this point in the history
* use full link for WordPress resources (#7211)

Co-authored-by: Niels Lange <[email protected]>

* Empty commit for release pull request

* update readme

* add testing instructions

* add zip file link

* update testing instructions and changelog entry

* Bumping version strings to new version.

Co-authored-by: Seghir Nadir <[email protected]>
Co-authored-by: Niels Lange <[email protected]>
Co-authored-by: github-actions <[email protected]>
Co-authored-by: Luigi <[email protected]>
  • Loading branch information
5 people authored Sep 23, 2022
1 parent d7d8173 commit 13e628c
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 5 deletions.
13 changes: 13 additions & 0 deletions docs/internal-developers/testing/releases/851.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Testing notes and ZIP for release 8.5.1

Zip file for testing: [woocommerce-gutenberg-products-block.zip](https://github.com/woocommerce/woocommerce-blocks/files/9633294/woocommerce-gutenberg-products-block.zip)

## Feature plugin and package inclusion in WooCommerce

### Fix a bug in which resource hinting was breaking cart in subfolder installs. ([7211](https://github.com/woocommerce/woocommerce-blocks/pull/7211))


1. Make sure Gutenberg is disabled.
2. Add an item to cart.
3. Go to any frontend page, and view the page source.
4. In that source page, search for scripts starting with `/wp-includes`, you shouldn't see any relative links in them, e.g. /wp-includes/js/dist/vendor/lodash.min.js, but that everything starts with a full link, e.g. <https://example.com/wp-includes/js/dist/vendor/lodash.min.js>.
1 change: 1 addition & 0 deletions docs/internal-developers/testing/releases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Every release includes specific testing instructions for new features and bug fi
- [8.3.1](./831.md)
- [8.4.0](./840.md)
- [8.5.0](./850.md)
- [8.5.1](./851.md)

<!-- FEEDBACK -->

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@woocommerce/block-library",
"title": "WooCommerce Blocks",
"author": "Automattic",
"version": "8.5.0",
"version": "8.5.1",
"description": "WooCommerce blocks for the Gutenberg editor.",
"homepage": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/",
"keywords": [
Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: gutenberg, woocommerce, woo commerce, products, blocks, woocommerce blocks
Requires at least: 6.0
Tested up to: 6.0
Requires PHP: 7.0
Stable tag: 8.5.0
Stable tag: 8.5.1
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -86,6 +86,12 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](https:/

== Changelog ==

= 8.5.1 - 2022-09-23 =

#### Bug Fixes

- Ensure that scripts are loaded using absolute URLs to prevent loading issues with subfolder installs. ([7211](https://github.com/woocommerce/woocommerce-blocks/pull/7211))

= 8.5.0 - 2022-09-12 =

#### Enhancements
Expand Down
16 changes: 15 additions & 1 deletion src/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private function get_script_dependency_src_array( array $dependencies ) {
$dependencies,
function( $src, $handle ) use ( $wp_scripts ) {
if ( isset( $wp_scripts->registered[ $handle ] ) ) {
$src[] = add_query_arg( 'ver', $wp_scripts->registered[ $handle ]->ver, $wp_scripts->registered[ $handle ]->src );
$src[] = add_query_arg( 'ver', $wp_scripts->registered[ $handle ]->ver, $this->get_absolute_url( $wp_scripts->registered[ $handle ]->src ) );
$src = array_merge( $src, $this->get_script_dependency_src_array( $wp_scripts->registered[ $handle ]->deps ) );
}
return $src;
Expand All @@ -172,6 +172,20 @@ function( $src, $handle ) use ( $wp_scripts ) {
);
}

/**
* Returns an absolute url to relative links for WordPress core scripts.
*
* @param string $src Original src that can be relative.
* @return string Correct full path string.
*/
private function get_absolute_url( $src ) {
$wp_scripts = wp_scripts();
if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $wp_scripts->content_url && 0 === strpos( $src, $wp_scripts->content_url ) ) ) {
$src = $wp_scripts->base_url . $src;
}
return $src;
}

/**
* Add body classes to the frontend and within admin.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static function container( $reset = false ) {
NewPackage::class,
function ( $container ) {
// leave for automated version bumping.
$version = '8.5.0';
$version = '8.5.1';
return new NewPackage(
$version,
dirname( __DIR__ ),
Expand Down
2 changes: 1 addition & 1 deletion woocommerce-gutenberg-products-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Blocks
* Plugin URI: https://github.com/woocommerce/woocommerce-gutenberg-products-block
* Description: WooCommerce blocks for the Gutenberg editor.
* Version: 8.5.0
* Version: 8.5.1
* Author: Automattic
* Author URI: https://woocommerce.com
* Text Domain: woo-gutenberg-products-block
Expand Down

0 comments on commit 13e628c

Please sign in to comment.