Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#### [unreleased]
* remove `git_updater_plugin_updates` and `git_updater_theme_updates` options, see [#1119](https://github.com/afragen/git-updater/issues/1119)
* add `gu_plugin_name()` to return plugin name, slug or slug-didhash
* include the reason why an API data response is incorrect

#### 12.20.2 / 2025-12-08
* harden REST API data for versions if relesase_assets and tags are empty -- this can happen if too many tags are created that aren't semver format
Expand Down
11 changes: 9 additions & 2 deletions src/Git_Updater/REST/REST_API.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,15 @@ public function get_api_data( WP_REST_Request $request ) {
add_filter( 'gu_disable_wpcron', '__return_false' );
$repo_data = Singleton::get_instance( 'Fragen\Git_Updater\Base', $this )->get_remote_repo_meta( $gu_repos[ $slug ] );

if ( ! is_object( $repo_data ) || '0.0.0' === $repo_data->remote_version ) {
return (object) [ 'error' => 'API data response is incorrect.' ];
$api_data_incorrect_error = (object) [ 'error' => 'API data response is incorrect.' ];
if ( ! is_object( $repo_data ) ) {
$repo_data_type = gettype( $repo_data );
$api_data_incorrect_error->error .= " Object expected, {$repo_data_type} returned.";
return $api_data_incorrect_error;
}
if ( '0.0.0' === $repo_data->remote_version ) {
$api_data_incorrect_error->error .= ' The remote version is "0.0.0".';
return $api_data_incorrect_error;
}

$last_updated = ! empty( $repo_data->created_at ) ? reset( $repo_data->created_at ) : $repo_data->last_updated;
Expand Down