Skip to content

Commit

Permalink
Fix migrate storage bug (go-gitea#28830)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored and henrygoodman committed Jan 31, 2024
1 parent 9d9a8e6 commit 3f2b4dc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/migrate_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,19 @@ func migrateLFS(ctx context.Context, dstStorage storage.ObjectStorage) error {

func migrateAvatars(ctx context.Context, dstStorage storage.ObjectStorage) error {
return db.Iterate(ctx, nil, func(ctx context.Context, user *user_model.User) error {
if user.CustomAvatarRelativePath() == "" {
return nil
}
_, err := storage.Copy(dstStorage, user.CustomAvatarRelativePath(), storage.Avatars, user.CustomAvatarRelativePath())
return err
})
}

func migrateRepoAvatars(ctx context.Context, dstStorage storage.ObjectStorage) error {
return db.Iterate(ctx, nil, func(ctx context.Context, repo *repo_model.Repository) error {
if repo.CustomAvatarRelativePath() == "" {
return nil
}
_, err := storage.Copy(dstStorage, repo.CustomAvatarRelativePath(), storage.RepoAvatars, repo.CustomAvatarRelativePath())
return err
})
Expand Down

0 comments on commit 3f2b4dc

Please sign in to comment.