Skip to content

Commit

Permalink
Update regex to handle version tags like -rc and -beta in plugin …
Browse files Browse the repository at this point in the history
…download links
  • Loading branch information
ShyamGadde committed Nov 22, 2024
1 parent 03607c4 commit 8398cfe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/performance-lab/includes/admin/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ function perflab_install_and_activate_plugin( string $plugin_slug, array &$proce
$skin = new WP_Ajax_Upgrader_Skin( array( 'api' => $plugin_data ) );
$upgrader = new Plugin_Upgrader( $skin );
// Remove the version number from the link to download the latest plugin version.
$download_link = (string) preg_replace( '#(\/plugin\/[^\/]+)\.\d+\.\d+\.\d+\.zip#', '$1.zip', $plugin_data['download_link'] );
$download_link = (string) preg_replace( '#(\/plugin\/[^\/]+)\.\d+\.\d+\.\d+(?:-\w+)?\.zip#', '$1.zip', $plugin_data['download_link'] );
$result = $upgrader->install( $download_link );

if ( is_wp_error( $result ) ) {
Expand Down

0 comments on commit 8398cfe

Please sign in to comment.