Fix exist method

This commit is contained in:
Peter Stuifzand 2021-08-15 21:36:08 +02:00
parent 81f3047829
commit 1b2da4e18f

View File

@ -644,12 +644,11 @@ func saveWithGit(fp *FilePages, p string, summary, author string) error {
func (fp *FilePages) Exist(p string) bool {
pageName := filepath.Join(fp.dirname, strings.Replace(p, " ", "_", -1))
log.Printf("Exist? %s\n", pageName)
_, err := os.Stat(pageName)
if err != nil {
return os.IsExist(err)
return !os.IsNotExist(err)
}
return false
return true
}
func DiffPrettyHtml(diffs []diffmatchpatch.Diff) string {