Skip to content

Commit 8398cfe

Browse files
committed
Update regex to handle version tags like -rc and -beta in plugin download links
1 parent 03607c4 commit 8398cfe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugins/performance-lab/includes/admin/plugins.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ function perflab_install_and_activate_plugin( string $plugin_slug, array &$proce
373373
$skin = new WP_Ajax_Upgrader_Skin( array( 'api' => $plugin_data ) );
374374
$upgrader = new Plugin_Upgrader( $skin );
375375
// Remove the version number from the link to download the latest plugin version.
376-
$download_link = (string) preg_replace( '#(\/plugin\/[^\/]+)\.\d+\.\d+\.\d+\.zip#', '$1.zip', $plugin_data['download_link'] );
376+
$download_link = (string) preg_replace( '#(\/plugin\/[^\/]+)\.\d+\.\d+\.\d+(?:-\w+)?\.zip#', '$1.zip', $plugin_data['download_link'] );
377377
$result = $upgrader->install( $download_link );
378378

379379
if ( is_wp_error( $result ) ) {

0 commit comments

Comments
 (0)