summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2024-01-22 00:32:06 +0800
committerGitHub <noreply@github.com>2024-01-21 16:32:06 +0000
commitcf9a416d62308186dd51b283976bc2b37c8673f7 (patch)
tree0c57aaa1d8dc74cb8453ba07ff7ade6899e98bdf /cmd
parent8c7bda8755cc5fd1b12c5516fb60b7f63af4aecf (diff)
downloadgitea-cf9a416d62308186dd51b283976bc2b37c8673f7.tar.gz
gitea-cf9a416d62308186dd51b283976bc2b37c8673f7.zip
Fix migrate storage bug (#28830) (#28867)
Backport #28830 by @lunny Fix #28728 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/migrate_storage.go6
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
})