diff options
author | bep <bjorn.erik.pedersen@gmail.com> | 2014-12-10 16:48:51 +0100 |
---|---|---|
committer | bep <bjorn.erik.pedersen@gmail.com> | 2014-12-10 20:32:39 +0100 |
commit | e6541c45ab1a3d15acd1beea73df5d17d08c7769 (patch) | |
tree | dc366d6388e24ae2623afdac8f0025a7112d6299 /source/filesystem.go | |
parent | 9f77f93071d836a35b0078d1b349968abddb4a18 (diff) |
ERROR-log on symbolic links
filepath.Walk does not follow symbolic links.
There's no easy fix for that outside of Go, so the best we can do for now is to give notice to the end user by ERROR log statements.
This commit also fixes a related panic situation in GenerateTemplateNameFrom when the layout dir was a symbolic link.
Fixes #283
Diffstat (limited to 'source/filesystem.go')
-rw-r--r-- | source/filesystem.go | 9 |
1 files changed, 7 insertions, 2 deletions
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 |