From 9bcce850e9b39c6c79deeb2a9a033740ba9789fc Mon Sep 17 00:00:00 2001 From: Joseph Ferguson Date: Thu, 28 Sep 2023 10:05:48 -0700 Subject: [PATCH] Update logo upload to simlpler single API reguest flow --- push.pl | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/push.pl b/push.pl index 2092c8d6c89f2..bd3331acde6ad 100755 --- a/push.pl +++ b/push.pl @@ -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