1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-25 01:33:58 +03:00

fix migration failed when authorized_keys is not exist (#1180)

This commit is contained in:
Lunny Xiao 2017-03-23 00:04:31 +08:00 committed by Bo-Yi Wu
parent d349f059af
commit d330a23ce1

View File

@ -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 {