private function uploadAssetForRelease($release, $repo) {
$this->setTokenForUser($repo->owner->login);
$asset = $this->createReleaseAsset($release, $repo);
- $this->github->createReleaseAsset($release->upload_url, $asset, "application/phar", function($json) {
+ // FIXME: use uri_template extension
+ $name = sprintf("%s-%s.ext.phar", $repo->name, $release->tag_name);
+ $url = str_replace("{?name}", "?name=$name", $release->upload_url);
+ $this->github->createReleaseAsset($url, $asset, "application/phar", function($json) {
$response = $this->app->getResponse();
$response->setResponseCode(201);
$response->setHeader("Location", $json->url);
class ReleaseAsset extends Create
{
function getRequest() {
- // FIXME: use uri_template extension
- $url = str_replace("{?name}", "?name=".urlencode(basename($this->args["asset"])), $this->args["url"]);
$body = new \http\Message\Body(fopen($this->args["asset"], "rb"));
- $request = new Request("POST", $url, [
+ $request = new Request("POST", $this->args["url"], [
"Accept" => "application/vnd.github.v3+json",
"Content-Type" => $this->args["type"],
"Authorization" => "token ". $this->api->getToken()