summaryrefslogtreecommitdiffhomepage
path: root/hugolib/filesystems
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2018-09-23 17:00:33 +0200
committerBjørn Erik Pedersen <[email protected]>2018-09-23 17:18:35 +0200
commitf9168146978bd970d1f4fb061eff75264af88bb1 (patch)
treede1c92bd07ef177489c1169570cda0d2123a4823 /hugolib/filesystems
parentcae07ce84b3bd4a33fd18b5109a1a3c3dce2191c (diff)
downloadhugo-f9168146978bd970d1f4fb061eff75264af88bb1.tar.gz
hugo-f9168146978bd970d1f4fb061eff75264af88bb1.zip
Prevent symbolic links from themes
Diffstat (limited to 'hugolib/filesystems')
-rw-r--r--hugolib/filesystems/basefs.go1
-rw-r--r--hugolib/filesystems/basefs_test.go6
2 files changed, 7 insertions, 0 deletions
diff --git a/hugolib/filesystems/basefs.go b/hugolib/filesystems/basefs.go
index c8d568270..77a68a8ae 100644
--- a/hugolib/filesystems/basefs.go
+++ b/hugolib/filesystems/basefs.go
@@ -718,6 +718,7 @@ func createThemesOverlayFs(p *paths.Paths) (afero.Fs, []string, error) {
}
fs, err := createOverlayFs(p.Fs.Source, absPaths)
+ fs = hugofs.NewNoLstatFs(fs)
return fs, absPaths, err
diff --git a/hugolib/filesystems/basefs_test.go b/hugolib/filesystems/basefs_test.go
index ffa430add..9f4b512fd 100644
--- a/hugolib/filesystems/basefs_test.go
+++ b/hugolib/filesystems/basefs_test.go
@@ -218,6 +218,12 @@ func TestRealDirs(t *testing.T) {
checkFileCount(bfs.Resources.Fs, "", assert, 3)
+ assert.NotNil(bfs.themeFs)
+ fi, b, err := bfs.themeFs.(afero.Lstater).LstatIfPossible(filepath.Join("resources", "t1.txt"))
+ assert.NoError(err)
+ assert.False(b)
+ assert.Equal("t1.txt", fi.Name())
+
}
func TestStaticFs(t *testing.T) {