From fd986b1cfa98a372c380732b0d8507de2814848e Mon Sep 17 00:00:00 2001 From: obgnail Date: Thu, 4 Jan 2024 14:33:24 +0800 Subject: [PATCH] update downloadURL --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index f1d0483..30a8499 100644 --- a/main.go +++ b/main.go @@ -55,12 +55,12 @@ func uploadImages(ctx context.Context, client *github.Client, images []string) [ _path := fmt.Sprintf("image/%d_%d%s", timestamp, idx, suffix) message := strconv.FormatInt(timestamp, 10) options := &github.RepositoryContentFileOptions{Message: &message, Content: data} - _, _, err = client.Repositories.CreateFile(ctx, owner, repo, _path, options) + commit, _, err := client.Repositories.CreateFile(ctx, owner, repo, _path, options) if err != nil { fmt.Printf("Error committing file %s: %v", image, err) continue } - urls[idx] = fmt.Sprintf("https://raw.githubusercontent.com/%s/%s/master/%s", owner, repo, _path) + urls[idx] = *commit.Content.DownloadURL } return urls }