Skip to content

Commit

Permalink
Merge pull request #29 from stellarwp/fix/update-url
Browse files Browse the repository at this point in the history
[fix] Fix update URL
  • Loading branch information
jamesckemp authored Aug 25, 2023
2 parents 495184b + bbb574e commit da2ec25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Uplink/API/Validation_Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public function get_update_details() {
$update->url = $this->response->homepage ?? '';
$update->tested = $this->response->tested ?? '';
$update->requires = $this->response->requires ?? '';
$update->package = $this->response->download_url ? $this->response->download_url . '&pu_get_download=1&key=' . $this->get_key() : '';
$update->package = $this->response->download_url ? $this->response->download_url . '&key=' . urlencode( $this->get_key() ) : '';

if ( ! empty( $this->response->upgrade_notice ) ) {
$update->upgrade_notice = $this->response->upgrade_notice;
Expand Down Expand Up @@ -495,7 +495,7 @@ public function to_wp_format() {
}

//Other fields need to be renamed and/or transformed.
$info->download_link = isset( $this->response->download_url ) ? $this->response->download_url . '&pu_get_download=1' : '';
$info->download_link = isset( $this->response->download_url ) ? $this->response->download_url : '';

if ( ! empty( $this->author_homepage ) && ! empty( $this->response->author ) ) {
$info->author = sprintf( '<a href="%s">%s</a>', esc_url( $this->author_homepage ), $this->response->author );
Expand Down
4 changes: 3 additions & 1 deletion tests/_support/Helper/Http_API/Http_API_Mock.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace StellarWP\Uplink\Tests\Http_API;

use WpOrg\Requests\Response as Requests_Response;

abstract class Http_API_Mock {
/**
* A map from status codes to the HTTP standard status description.
Expand Down Expand Up @@ -99,7 +101,7 @@ public function make_response( int $status_code, $body, string $content_type = '

$url = rtrim( $this->get_url(), '/' );
$current_date = ( new \DateTime( 'now', new \DateTimezone( 'GMT' ) ) )->format( 'D, d M Y H:i:s GMT' );
$request_response = new \Requests_Response();
$request_response = new Requests_Response();
$request_response->headers = new \Requests_Response_Headers( [
'date' => [ $current_date ],
'content-type' => [ "$content_type; charset=UTF-8" ],
Expand Down

0 comments on commit da2ec25

Please sign in to comment.