Skip to content

Commit

Permalink
Update logo upload to simlpler single API reguest flow
Browse files Browse the repository at this point in the history
  • Loading branch information
yosifkit committed Sep 28, 2023
1 parent b239baf commit 9bcce85
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions push.pl
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,8 @@ sub prompt_for_edit {
}
else {
say 'putting logo ' . $repoLogo120;
my $logoUpload = $ua->get($logoUrlBase . '/upload' => $authorizationHeader);
die 'GET to ' . $logoUrlBase . '/upload failed: ' . $logoUpload->res->text unless $logoUpload->res->is_success;
my $logoUploadUrl = $logoUpload->res->json->{url};
my $logoPut = $ua->put($logoUploadUrl => { 'Content-Type' => 'image/png' } => $proposedLogo);
die 'PUT to ' . $logoUrlBase . ' (via "/upload" secure URL) failed: ' . $logoPut->res->text unless $logoPut->res->is_success;
my $logoComplete = $ua->post($logoUrlBase . '/upload/complete' => $authorizationHeader);
die 'POST to ' . $logoUrlBase . '/upload/complete failed: ' . $logoComplete->res->text unless $logoComplete->res->is_success;
my $logoUpload = $ua->post($logoUrlBase . '/upload' => { %$authorizationHeader, 'Content-Type' => 'image/png' } => b64_encode $proposedLogo);
die 'POST to ' . $logoUrlBase . '/upload failed: ' . $logoUpload->res->text unless $logoUpload->res->is_success;
}
} else {
# if we had no logo file, we should send a DELETE request to the API just to be sure we're synchronizing the repo state appropriately even on complete logo removal
Expand Down

0 comments on commit 9bcce85

Please sign in to comment.