Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Fix update URL #29

Merged
merged 2 commits into from
Aug 25, 2023
Merged
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
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
Loading