From 9133a0daa2552460ae655c9aeb90a01ed0c528eb Mon Sep 17 00:00:00 2001 From: george wheatcroft Date: Thu, 23 Mar 2023 22:22:35 +0000 Subject: [PATCH 1/2] fix issue of downloading and using github sourced migration files of 100MB >=1Mb (which previously failed to download due to their size and the api call performed) by preferring the go-github client library method 'DownloadContents' for such operations (which doesn't have the same limitation) --- source/github/github.go | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/source/github/github.go b/source/github/github.go index cefcf7280..cea429d8c 100644 --- a/source/github/github.go +++ b/source/github/github.go @@ -178,7 +178,7 @@ func (g *Github) ReadUp(version uint) (r io.ReadCloser, identifier string, err e g.ensureFields() if m, ok := g.migrations.Up(version); ok { - file, _, _, err := g.client.Repositories.GetContents( + r, _, err := g.client.Repositories.DownloadContents( context.Background(), g.config.Owner, g.config.Repo, @@ -189,13 +189,7 @@ func (g *Github) ReadUp(version uint) (r io.ReadCloser, identifier string, err e if err != nil { return nil, "", err } - if file != nil { - r, err := file.GetContent() - if err != nil { - return nil, "", err - } - return io.NopCloser(strings.NewReader(r)), m.Identifier, nil - } + return r, m.Identifier, nil } return nil, "", &os.PathError{Op: fmt.Sprintf("read version %v", version), Path: g.config.Path, Err: os.ErrNotExist} } @@ -204,7 +198,7 @@ func (g *Github) ReadDown(version uint) (r io.ReadCloser, identifier string, err g.ensureFields() if m, ok := g.migrations.Down(version); ok { - file, _, _, err := g.client.Repositories.GetContents( + r, _, err := g.client.Repositories.DownloadContents( context.Background(), g.config.Owner, g.config.Repo, @@ -215,13 +209,7 @@ func (g *Github) ReadDown(version uint) (r io.ReadCloser, identifier string, err if err != nil { return nil, "", err } - if file != nil { - r, err := file.GetContent() - if err != nil { - return nil, "", err - } - return io.NopCloser(strings.NewReader(r)), m.Identifier, nil - } + return r, m.Identifier, nil } return nil, "", &os.PathError{Op: fmt.Sprintf("read version %v", version), Path: g.config.Path, Err: os.ErrNotExist} } From 021a9c1bdb0946d56bd44b1f10ae09b3dcdac49f Mon Sep 17 00:00:00 2001 From: george wheatcroft Date: Thu, 23 Mar 2023 22:58:59 +0000 Subject: [PATCH 2/2] empty commit & push to trigger ci