Skip to content

Commit

Permalink
fix: create correct uri on retry
Browse files Browse the repository at this point in the history
  • Loading branch information
janbritz committed Feb 6, 2025
1 parent b6ea6bf commit 4adeb24
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions classes/api/package_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function download_static_file(string $namespace, string $shortname, strin
/**
* Send a POST request and retry if the server doesn't have the package file cached, but we have it available.
*
* @param string $uri can be absolute or relative to the base url
* @param string $uri relative to the base url
* @param array $options request options as per
* {@link https://docs.guzzlephp.org/en/stable/request-options.html Guzzle docs}
* @param bool $allowretry if set to false, retry won't be attempted if the package file isn't cached, instead
Expand All @@ -217,10 +217,10 @@ public function download_static_file(string $namespace, string $shortname, strin
* @throws request_error
*/
private function post_and_maybe_retry(string $uri, array $options = [], bool $allowretry = true): ResponseInterface {
$uri = "/packages/$this->hash/" . ltrim($uri, '/');
$fulluri = "/packages/$this->hash/" . ltrim($uri, '/');

try {
return $this->client->post($uri, $options);
return $this->client->post($fulluri, $options);
} catch (request_error $e) {
if (!$allowretry || !$this->file || $e->requesterrorcode !== error_code::package_not_found) {
throw $e;
Expand Down

0 comments on commit 4adeb24

Please sign in to comment.