Skip to content

Commit cf9a416

Browse files
GiteaBotlunny
andauthored
Fix migrate storage bug (#28830) (#28867)
Backport #28830 by @lunny Fix #28728 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
1 parent 8c7bda8 commit cf9a416

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmd/migrate_storage.go

+6
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,19 @@ func migrateLFS(ctx context.Context, dstStorage storage.ObjectStorage) error {
110110

111111
func migrateAvatars(ctx context.Context, dstStorage storage.ObjectStorage) error {
112112
return db.Iterate(ctx, nil, func(ctx context.Context, user *user_model.User) error {
113+
if user.CustomAvatarRelativePath() == "" {
114+
return nil
115+
}
113116
_, err := storage.Copy(dstStorage, user.CustomAvatarRelativePath(), storage.Avatars, user.CustomAvatarRelativePath())
114117
return err
115118
})
116119
}
117120

118121
func migrateRepoAvatars(ctx context.Context, dstStorage storage.ObjectStorage) error {
119122
return db.Iterate(ctx, nil, func(ctx context.Context, repo *repo_model.Repository) error {
123+
if repo.CustomAvatarRelativePath() == "" {
124+
return nil
125+
}
120126
_, err := storage.Copy(dstStorage, repo.CustomAvatarRelativePath(), storage.RepoAvatars, repo.CustomAvatarRelativePath())
121127
return err
122128
})

0 commit comments

Comments
 (0)