diff options
-rw-r--r-- | cmd/restore.go | 8 | ||||
-rw-r--r-- | gogs.go | 2 | ||||
-rw-r--r-- | templates/.VERSION | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/cmd/restore.go b/cmd/restore.go index 8e2d2d1f..19c26464 100644 --- a/cmd/restore.go +++ b/cmd/restore.go @@ -103,13 +103,19 @@ func runRestore(c *cli.Context) error { if !c.Bool("database-only") { os.MkdirAll(setting.AppDataPath, os.ModePerm) for _, dir := range []string{"attachments", "avatars"} { + // Skip if backup archive does not have corresponding data + srcPath := path.Join(archivePath, "data", dir) + if !com.IsDir(srcPath) { + continue + } + dirPath := path.Join(setting.AppDataPath, dir) if com.IsExist(dirPath) { if err = os.Rename(dirPath, dirPath+".bak"); err != nil { log.Fatal(0, "Fail to backup current 'data': %v", err) } } - if err = os.Rename(path.Join(archivePath, "data", dir), dirPath); err != nil { + if err = os.Rename(srcPath, dirPath); err != nil { log.Fatal(0, "Fail to import 'data': %v", err) } } @@ -16,7 +16,7 @@ import ( "github.com/gogits/gogs/pkg/setting" ) -const APP_VER = "0.11.22.0621" +const APP_VER = "0.11.23.0625" func init() { setting.AppVer = APP_VER diff --git a/templates/.VERSION b/templates/.VERSION index 9076ba81..d91dbf21 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.11.22.0621
\ No newline at end of file +0.11.23.0625
\ No newline at end of file |