summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/hugo.go5
-rw-r--r--source/filesystem.go9
-rw-r--r--tpl/template.go19
3 files changed, 24 insertions, 9 deletions
diff --git a/commands/hugo.go b/commands/hugo.go
index 6fd7fa2bd..45eed3e28 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -256,6 +256,11 @@ func getDirList() []string {
return nil
}
+ if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
+ jww.ERROR.Printf("Symbolic links not supported, skipping '%s'", path)
+ return nil
+ }
+
if fi.IsDir() {
a = append(a, path)
}
diff --git a/source/filesystem.go b/source/filesystem.go
index d89149dc6..df0a4989c 100644
--- a/source/filesystem.go
+++ b/source/filesystem.go
@@ -15,13 +15,13 @@ package source
import (
"bytes"
+ "github.com/spf13/hugo/helpers"
+ jww "github.com/spf13/jwalterweatherman"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
-
- "github.com/spf13/hugo/helpers"
)
type Input interface {
@@ -84,6 +84,11 @@ func (f *Filesystem) captureFiles() {
return nil
}
+ if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
+ jww.ERROR.Printf("Symbolic links not supported, skipping '%s'", filePath)
+ return nil
+ }
+
if fi.IsDir() {
if f.avoid(filePath) || isNonProcessablePath(filePath) {
return filepath.SkipDir
diff --git a/tpl/template.go b/tpl/template.go
index 5010af9ae..d057f174d 100644
--- a/tpl/template.go
+++ b/tpl/template.go
@@ -16,6 +16,11 @@ package tpl
import (
"bytes"
"errors"
+ "github.com/eknkc/amber"
+ "github.com/spf13/cast"
+ "github.com/spf13/hugo/helpers"
+ jww "github.com/spf13/jwalterweatherman"
+ "github.com/yosssi/ace"
"html"
"html/template"
"io"
@@ -25,12 +30,6 @@ import (
"reflect"
"strconv"
"strings"
-
- "github.com/eknkc/amber"
- "github.com/spf13/cast"
- "github.com/spf13/hugo/helpers"
- jww "github.com/spf13/jwalterweatherman"
- "github.com/yosssi/ace"
)
var localTemplates *template.Template
@@ -703,7 +702,8 @@ func (t *GoHtmlTemplate) AddTemplateFile(name, path string) error {
}
func (t *GoHtmlTemplate) GenerateTemplateNameFrom(base, path string) string {
- return filepath.ToSlash(path[len(base)+1:])
+ name, _ := filepath.Rel(base, path)
+ return filepath.ToSlash(name)
}
func ignoreDotFile(path string) bool {
@@ -716,6 +716,11 @@ func (t *GoHtmlTemplate) loadTemplates(absPath string, prefix string) {
return nil
}
+ if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
+ jww.ERROR.Printf("Symbolic links not supported, skipping '%s'", absPath)
+ return nil
+ }
+
if !fi.IsDir() {
if ignoreDotFile(path) {
return nil