Only accept return_url when do_update_woocommerce is present (#48163)

* Accept return_url only when do_update_woocommerce exist

* Add changefile(s) from automation for the following project(s): woocommerce

* Update 48163-fix-db-update-redirect-issue

* Add changefile(s) from automation for the following project(s): woocommerce

* Update plugins/woocommerce/changelog/48163-fix-db-update-redirect-issue

Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
This commit is contained in:
Moon 2024-06-06 18:50:43 +12:00 committed by GitHub
parent 22309f0484
commit d86a90ba9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
Fix db update notice redirection bug where it redirects without checking for db update action. </details> <details> <summary>Changelog Entry Comment</summary>

View File

@ -423,10 +423,11 @@ class WC_Install {
check_admin_referer( 'wc_db_update', 'wc_db_update_nonce' );
self::update();
WC_Admin_Notices::add_notice( 'update', true );
}
if ( ! empty( $_GET['return_url'] ) ) { // WPCS: input var ok.
$return_url = esc_url_raw( wp_unslash( $_GET['return_url'] ) );
wp_safe_redirect( $return_url ); // WPCS: input var ok.
if ( ! empty( $_GET['return_url'] ) ) { // WPCS: input var ok.
$return_url = esc_url_raw( wp_unslash( $_GET['return_url'] ) );
wp_safe_redirect( $return_url ); // WPCS: input var ok.
}
}
}