diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-03-23 00:04:31 +0800 |
---|---|---|
committer | Bo-Yi Wu <appleboy.tw@gmail.com> | 2017-03-23 00:04:31 +0800 |
commit | d330a23ce1d20d684b4ee6905cb295fb5b39e398 (patch) | |
tree | ab1244cc8dd7a07ae04e6342526ea8e73dd3570f | |
parent | d349f059afa7dc3597ab565d4bb9d4c0271806fc (diff) | |
download | gitea-d330a23ce1d20d684b4ee6905cb295fb5b39e398.tar.gz gitea-d330a23ce1d20d684b4ee6905cb295fb5b39e398.zip |
fix migration failed when authorized_keys is not exist (#1180)
-rw-r--r-- | models/migrations/v21.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/models/migrations/v21.go b/models/migrations/v21.go index f7f01f062b..e049727cbe 100644 --- a/models/migrations/v21.go +++ b/models/migrations/v21.go @@ -11,6 +11,7 @@ import ( "code.gitea.io/gitea/modules/setting" + "github.com/Unknwon/com" "github.com/go-xorm/xorm" ) @@ -21,6 +22,10 @@ const ( func useNewPublickeyFormat(x *xorm.Engine) error { fpath := filepath.Join(setting.SSH.RootPath, "authorized_keys") + if !com.IsExist(fpath) { + return nil + } + tmpPath := fpath + ".tmp" f, err := os.OpenFile(tmpPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) if err != nil { |