Skip to content

Commit

Permalink
Do not parse backup files with trailing '~' as templates
Browse files Browse the repository at this point in the history
Fixes #964
  • Loading branch information
anthonyfok committed Mar 10, 2015
1 parent 8169571 commit 3ba279c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tpl/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,10 @@ func isDotFile(path string) bool {
return filepath.Base(path)[0] == '.'
}

func isBackupFile(path string) bool {
return path[len(path)-1] == '~'
}

func (t *GoHtmlTemplate) loadTemplates(absPath string, prefix string) {
walker := func(path string, fi os.FileInfo, err error) error {
if err != nil {
Expand All @@ -1254,7 +1258,7 @@ func (t *GoHtmlTemplate) loadTemplates(absPath string, prefix string) {
}

if !fi.IsDir() {
if isDotFile(path) {
if isDotFile(path) || isBackupFile(path) {
return nil
}

Expand Down

0 comments on commit 3ba279c

Please sign in to comment.