summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2024-02-20 14:46:03 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2024-02-20 17:00:32 +0100
commit621194a3197d27e3b5909bca9b3efa6ae70da86c (patch)
tree9dbdeac8dae393df7b63351a63bc166cc19ddecb /hugolib
parent48eec2a4e63cb0b542858f3b133eba19aa23978c (diff)
Fix dart sass import regression
Fixes #12072
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/filesystems/basefs.go10
-rw-r--r--hugolib/filesystems/basefs_test.go6
-rw-r--r--hugolib/pagecollections.go2
3 files changed, 9 insertions, 9 deletions
diff --git a/hugolib/filesystems/basefs.go b/hugolib/filesystems/basefs.go
index b37fb8cb4..25c58d516 100644
--- a/hugolib/filesystems/basefs.go
+++ b/hugolib/filesystems/basefs.go
@@ -336,7 +336,7 @@ func (s *SourceFilesystems) ResolvePaths(filename string, checkExists bool) []hu
// It will return an empty string if the filename is not a member of a static filesystem.
func (s SourceFilesystems) MakeStaticPathRelative(filename string) string {
for _, staticFs := range s.Static {
- rel, _ := staticFs.MakePathRelative(filename)
+ rel, _ := staticFs.MakePathRelative(filename, true)
if rel != "" {
return rel
}
@@ -345,8 +345,8 @@ func (s SourceFilesystems) MakeStaticPathRelative(filename string) string {
}
// MakePathRelative creates a relative path from the given filename.
-func (d *SourceFilesystem) MakePathRelative(filename string) (string, bool) {
- cps, err := d.ReverseLookup(filename)
+func (d *SourceFilesystem) MakePathRelative(filename string, checkExists bool) (string, bool) {
+ cps, err := d.ReverseLookup(filename, checkExists)
if err != nil {
panic(err)
}
@@ -358,11 +358,11 @@ func (d *SourceFilesystem) MakePathRelative(filename string) (string, bool) {
}
// ReverseLookup returns the component paths for the given filename.
-func (d *SourceFilesystem) ReverseLookup(filename string) ([]hugofs.ComponentPath, error) {
+func (d *SourceFilesystem) ReverseLookup(filename string, checkExists bool) ([]hugofs.ComponentPath, error) {
var cps []hugofs.ComponentPath
hugofs.WalkFilesystems(d.Fs, func(fs afero.Fs) bool {
if rfs, ok := fs.(hugofs.ReverseLookupProvder); ok {
- if c, err := rfs.ReverseLookup(filename, true); err == nil {
+ if c, err := rfs.ReverseLookup(filename, checkExists); err == nil {
cps = append(cps, c...)
}
}
diff --git a/hugolib/filesystems/basefs_test.go b/hugolib/filesystems/basefs_test.go
index 5398055ed..ebbb378d3 100644
--- a/hugolib/filesystems/basefs_test.go
+++ b/hugolib/filesystems/basefs_test.go
@@ -380,11 +380,11 @@ Main.
`
b := hugolib.Test(t, files)
- rel, found := b.H.BaseFs.Assets.MakePathRelative(filepath.FromSlash("/themes/t1/src/main.js"))
+ rel, found := b.H.BaseFs.Assets.MakePathRelative(filepath.FromSlash("/themes/t1/src/main.js"), true)
b.Assert(found, qt.Equals, true)
b.Assert(rel, qt.Equals, filepath.FromSlash("foo/bar/main.js"))
- rel, found = b.H.BaseFs.Assets.MakePathRelative(filepath.FromSlash("/bar.txt"))
+ rel, found = b.H.BaseFs.Assets.MakePathRelative(filepath.FromSlash("/bar.txt"), true)
b.Assert(found, qt.Equals, true)
b.Assert(rel, qt.Equals, filepath.FromSlash("foo/baz.txt"))
}
@@ -460,7 +460,7 @@ Home.
b.AssertFileContent("public/index.html", "Home.")
stat := func(path string) hugofs.FileMetaInfo {
- ps, err := b.H.BaseFs.Content.ReverseLookup(filepath.FromSlash(path))
+ ps, err := b.H.BaseFs.Content.ReverseLookup(filepath.FromSlash(path), true)
b.Assert(err, qt.IsNil)
b.Assert(ps, qt.HasLen, 1)
first := ps[0]
diff --git a/hugolib/pagecollections.go b/hugolib/pagecollections.go
index 505b10bd7..58c646334 100644
--- a/hugolib/pagecollections.go
+++ b/hugolib/pagecollections.go
@@ -243,7 +243,7 @@ func (c *pageFinder) getContentNodeFromRefReverseLookup(ref string, fi hugofs.Fi
realFilename := filepath.Join(dir, ref)
- pcs, err := s.BaseFs.Content.ReverseLookup(realFilename)
+ pcs, err := s.BaseFs.Content.ReverseLookup(realFilename, true)
if err != nil {
return nil, err
}