Skip to content

Commit

Permalink
set correct headers even without token
Browse files Browse the repository at this point in the history
  • Loading branch information
afragen committed Feb 26, 2025
1 parent d8ee5b8 commit 61c3657
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#### [unreleased]
* make sure proper release asset headers are present even without token set

#### 12.13.0 / 2025-02-21
* update caching
Expand Down
2 changes: 1 addition & 1 deletion git-updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Plugin Name: Git Updater
* Plugin URI: https://git-updater.com
* Description: A plugin to automatically update GitHub hosted plugins, themes, and language packs. Additional API plugins available for Bitbucket, GitLab, Gitea, and Gist.
* Version: 12.13.0
* Version: 12.13.0.1
* Author: Andy Fragen
* License: MIT
* Domain Path: /languages
Expand Down
5 changes: 5 additions & 0 deletions src/Git_Updater/Traits/Basic_Auth_Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ final public function add_auth_header( $args, $url ) {
*/
$args = apply_filters( 'gu_get_auth_header', $args, $credentials );
}

// Make sure slug passed with no token.
if ( null !== $credentials['type'] && ! isset( $args['headers'][ $credentials['type'] ] ) ) {
$args['headers'][ $credentials['type'] ] = $credentials['slug'];
}
$args['headers'] = $args['headers'] ?? [];

return $args;
Expand Down

0 comments on commit 61c3657

Please sign in to comment.