Skip to content

Commit

Permalink
fix migration failed when authorized_keys is not exist (go-gitea#1375)
Browse files Browse the repository at this point in the history
* fix wiki bugs (go-gitea#1294)

* fix migration failed when authorized_keys is not exist
  • Loading branch information
lunny authored and Richard Mahn committed Apr 18, 2017
1 parent ecc2dbb commit 11cbb79
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions models/migrations/v21.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"code.gitea.io/gitea/modules/setting"

"github.com/Unknwon/com"
"github.com/go-xorm/xorm"
)

Expand All @@ -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 {
Expand Down

0 comments on commit 11cbb79

Please sign in to comment.