Skip to content

Commit 45bce86

Browse files
authored
Merge branch 'develop' into watch-serve
2 parents 90596d6 + 0c3e9cf commit 45bce86

File tree

5 files changed

+313
-12
lines changed

5 files changed

+313
-12
lines changed

.github/workflows/api-sync.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ jobs:
3838
3939
- name: Create Pull Request
4040
if: steps.check.outputs.has_changes == 'true'
41-
uses: peter-evans/create-pull-request@v5
41+
uses: peter-evans/create-pull-request@v7
4242
with:
43+
token: ${{ secrets.GH_PAT }}
4344
commit-message: "chore: sync API types from infrastructure"
4445
title: "chore: sync API types from infrastructure"
4546
body: |

internal/functions/download/download.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ import (
1010
"os/exec"
1111
"path"
1212
"path/filepath"
13+
"strings"
1314

15+
"github.com/andybalholm/brotli"
1416
"github.com/docker/docker/api/types/container"
1517
"github.com/docker/docker/api/types/network"
1618
"github.com/go-errors/errors"
1719
"github.com/spf13/afero"
20+
"github.com/spf13/viper"
1821
"github.com/supabase/cli/internal/utils"
1922
"github.com/supabase/cli/internal/utils/flags"
2023
"github.com/supabase/cli/pkg/api"
@@ -121,11 +124,13 @@ func Run(ctx context.Context, slug string, projectRef string, useLegacyBundle bo
121124
if err != nil {
122125
return err
123126
}
124-
defer func() {
125-
if err := fsys.Remove(eszipPath); err != nil {
126-
fmt.Fprintln(os.Stderr, err)
127-
}
128-
}()
127+
if !viper.GetBool("DEBUG") {
128+
defer func() {
129+
if err := fsys.Remove(eszipPath); err != nil {
130+
fmt.Fprintln(os.Stderr, err)
131+
}
132+
}()
133+
}
129134
// Extract eszip to functions directory
130135
err = extractOne(ctx, slug, eszipPath)
131136
if err != nil {
@@ -148,12 +153,16 @@ func downloadOne(ctx context.Context, slug, projectRef string, fsys afero.Fs) (s
148153
}
149154
return "", errors.Errorf("Error status %d: %s", resp.StatusCode, string(body))
150155
}
156+
r := io.Reader(resp.Body)
157+
if strings.EqualFold(resp.Header.Get("Content-Encoding"), "br") {
158+
r = brotli.NewReader(resp.Body)
159+
}
151160
// Create temp file to store downloaded eszip
152161
eszipPath := filepath.Join(utils.TempDir, fmt.Sprintf("output_%s.eszip", slug))
153162
if err := utils.MkdirIfNotExistFS(fsys, utils.TempDir); err != nil {
154163
return "", err
155164
}
156-
if err := afero.WriteReader(fsys, eszipPath, resp.Body); err != nil {
165+
if err := afero.WriteReader(fsys, eszipPath, r); err != nil {
157166
return "", errors.Errorf("failed to download file: %w", err)
158167
}
159168
return eszipPath, nil

pkg/api/client.gen.go

Lines changed: 268 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)