Skip to content

Commit 6dfb46a

Browse files
committed
set Base::upgrader_source_selection():$new_source to $source
when basenames are identical
1 parent 4ec956d commit 6dfb46a

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* update `freemius/wordpress-sdk`
66
* update `printf()` in `class Branches`
77
* fix old `git-updater-pro` and `git-updater-additions` textdomains
8+
* update `Base::upgrader_source_selection()` to not `move_dir()` when basenames of `$source` and `$new_source` are identical, fixes potential issue with release assets
89

910
#### 12.4.0 / 2024-03-04
1011
* update `freemius/wordpress-sdk`

git-updater.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Plugin Name: Git Updater
1313
* Plugin URI: https://git-updater.com
1414
* Description: A plugin to automatically update GitHub hosted plugins, themes, and language packs. Additional API plugins available for Bitbucket, GitLab, Gitea, and Gist.
15-
* Version: 12.4.0.5
15+
* Version: 12.4.0.6
1616
* Author: Andy Fragen
1717
* License: MIT
1818
* Domain Path: /languages

src/Git_Updater/Base.php

+5
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,17 @@ public function upgrader_source_selection( $source, $remote_source, $upgrader, $
502502

503503
$new_source = $this->fix_misnamed_directory( $new_source, $remote_source, $upgrader_object, $slug );
504504

505+
if ( basename( $source ) === basename( $new_source ) ) {
506+
$new_source = $source;
507+
}
508+
505509
if ( trailingslashit( strtolower( $source ) ) !== trailingslashit( strtolower( $new_source ) ) ) {
506510
$result = move_dir( $source, $new_source, true );
507511
if ( \is_wp_error( $result ) ) {
508512
return $result;
509513
}
510514
}
515+
511516
// Clean up $new_source directory.
512517
add_action( 'upgrader_install_package_result', [ $this, 'delete_upgrade_source' ], 10, 2 );
513518

0 commit comments

Comments
 (0)