diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-01-20 23:27:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-20 23:27:31 +0800 |
commit | 7711db0a7138a063a36a412d9780328795a9cea2 (patch) | |
tree | b98343920ddef52f01d49d856d4e7a9189aef9b0 /cmd/migrate_storage.go | |
parent | 5574968ecbc34908dfa17b28bfc79c3490eaa685 (diff) | |
download | gitea-7711db0a7138a063a36a412d9780328795a9cea2.tar.gz gitea-7711db0a7138a063a36a412d9780328795a9cea2.zip |
Fix migrate storage bug (#28830)
Diffstat (limited to 'cmd/migrate_storage.go')
-rw-r--r-- | cmd/migrate_storage.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd/migrate_storage.go b/cmd/migrate_storage.go index acc3ba16ba..aa49445a89 100644 --- a/cmd/migrate_storage.go +++ b/cmd/migrate_storage.go @@ -110,6 +110,9 @@ 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 }) @@ -117,6 +120,9 @@ func migrateAvatars(ctx context.Context, dstStorage storage.ObjectStorage) error 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 }) |