]> source.dussan.org Git - gitea.git/commitdiff
fix #659
authorUnknwon <joe2010xtmf@163.com>
Wed, 26 Nov 2014 03:48:04 +0000 (22:48 -0500)
committerUnknwon <joe2010xtmf@163.com>
Wed, 26 Nov 2014 03:48:04 +0000 (22:48 -0500)
cmd/fix.go

index dfcd04aa893c0e8e1f167eb90f946a2bc8198e6b..5122ff32c7ad89121f31398077084f60d39c8d45 100644 (file)
@@ -14,6 +14,7 @@ import (
        "runtime"
        "strings"
 
+       "github.com/Unknwon/com"
        "github.com/codegangsta/cli"
 
        "github.com/gogits/gogs/models"
@@ -164,10 +165,12 @@ func runFixLocation(ctx *cli.Context) {
 
        // Fix in authorized_keys file.
        sshPath := path.Join(models.SshPath, "authorized_keys")
-       fmt.Printf("Fixing pathes in file: %s\n", sshPath)
-       if err := rewriteAuthorizedKeys(sshPath, oldPath, execPath); err != nil {
-               fmt.Println(err)
-               os.Exit(1)
+       if com.IsFile(sshPath) {
+               fmt.Printf("Fixing pathes in file: %s\n", sshPath)
+               if err := rewriteAuthorizedKeys(sshPath, oldPath, execPath); err != nil {
+                       fmt.Println(err)
+                       os.Exit(1)
+               }
        }
 
        // Fix position in gogs-repositories.