summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorSandro Santilli <strk@kbt.io>2017-02-26 04:58:02 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2017-02-26 11:58:02 +0800
commitbf24099114d75dbc625bc8385a0a7d969d0c3748 (patch)
tree262eeafd90e9ba99315594dfa8088509a64853c2 /models
parent80f900ebae5c52f736f667a81bbc1ab815344efc (diff)
downloadgitea-bf24099114d75dbc625bc8385a0a7d969d0c3748.tar.gz
gitea-bf24099114d75dbc625bc8385a0a7d969d0c3748.zip
Allow migrating installations with no local avatars (#1056)
Diffstat (limited to 'models')
-rw-r--r--models/migrations/migrations.go2
-rw-r--r--models/migrations/v20.go4
2 files changed, 5 insertions, 1 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go
index 226e548171..b3e7fcc8c6 100644
--- a/models/migrations/migrations.go
+++ b/models/migrations/migrations.go
@@ -89,7 +89,7 @@ var migrations = []Migration{
// v19 -> v20
NewMigration("generate and migrate Git hooks", generateAndMigrateGitHooks),
// v20 -> v21
- NewMigration("use new avtar path name for security reason", useNewNameAvatars),
+ NewMigration("use new avatar path name for security reason", useNewNameAvatars),
}
// Migrate database to current version
diff --git a/models/migrations/v20.go b/models/migrations/v20.go
index 134a3d51e6..45d7e49ca8 100644
--- a/models/migrations/v20.go
+++ b/models/migrations/v20.go
@@ -21,6 +21,10 @@ import (
func useNewNameAvatars(x *xorm.Engine) error {
d, err := os.Open(setting.AvatarUploadPath)
if err != nil {
+ if os.IsNotExist(err) {
+ // Nothing to do if AvatarUploadPath does not exist
+ return nil
+ }
return err
}
names, err := d.Readdirnames(0)