Skip to content

Commit

Permalink
another test for conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
afragen committed Dec 18, 2024
1 parent ed15f8c commit 7057264
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Git_Updater/REST/REST_API.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,14 +403,15 @@ public function get_api_data( \WP_REST_Request $request ) {
'external' => 'xxx',
];

if ( $repo_api_data['is_private'] || in_array( $repo_api_data['git'], [ 'gitlab', 'gitea' ], true )
$repo_cache = $this->get_repo_cache( $slug );

if ( $repo_api_data['download_link'] && $repo_api_data['is_private'] || in_array( $repo_api_data['git'], [ 'gitlab', 'gitea' ], true )
) {
$repo_api_data['auth_header'] = Singleton::get_instance( 'Fragen\Git_Updater\API\API', $this )->add_auth_header( [], $repo_api_data['download_link'] );
$repo_api_data['auth_header'] = Singleton::get_instance( 'Fragen\Git_Updater\API\API', $this )->unset_release_asset_auth( $repo_api_data['auth_header'], $repo_api_data['download_link'] );
}

if ( $download && $repo_data->release_asset ) {
$repo_cache = $this->get_repo_cache( $slug );
if ( isset( $repo_cache['release_asset_redirect'] ) ) {
$repo_api_data['download_link'] = $repo_cache['release_asset_redirect'];
} elseif ( $repo_cache['release_asset'] ) {
Expand Down

0 comments on commit 7057264

Please sign in to comment.