Skip to content

Commit

Permalink
fix: fix blank background (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
CorrectRoadH authored Dec 17, 2024
1 parent bcbc756 commit c6c357e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/background.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ func BackgroundPath(version codegen.Version) string {

func DownloadReleaseBackground(url string, version string) {
// to check if the file exist
if _, err := os.Stat(BackgroundPath(version)); err == nil {
return
if fileInfo, err := os.Stat(BackgroundPath(version)); err == nil {
if fileInfo.Size() > 0 {
return
}
}

// if the background url is nil, return
Expand All @@ -35,6 +37,7 @@ func DownloadReleaseBackground(url string, version string) {
}
err := getClient.Get()
if err != nil {
os.Remove(BackgroundPath(version))
logger.Error("error when trying to download background", zap.Error(err))
} else {
logger.Info("download background success", zap.String("url", url), zap.String("version", version))
Expand Down

0 comments on commit c6c357e

Please sign in to comment.