mirror of
https://github.com/gohugoio/hugo.git
synced 2025-02-12 22:23:04 +00:00
parent
be366bfe1e
commit
beb32af7a2
2 changed files with 8 additions and 3 deletions
|
@ -75,8 +75,8 @@ func TestDataDirUnknownFormat(t *testing.T) {
|
||||||
}
|
}
|
||||||
s := &Site{}
|
s := &Site{}
|
||||||
err := s.loadData([]source.Input{&source.InMemorySource{ByteSource: sources}})
|
err := s.loadData([]source.Input{&source.InMemorySource{ByteSource: sources}})
|
||||||
if err == nil {
|
if err != nil {
|
||||||
t.Fatalf("Should return an error")
|
t.Fatalf("Should not return an error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -307,6 +307,10 @@ func (s *Site) loadData(sources []source.Input) (err error) {
|
||||||
return fmt.Errorf("Failed to read data from %s: %s", filepath.Join(r.Path(), r.LogicalName()), err)
|
return fmt.Errorf("Failed to read data from %s: %s", filepath.Join(r.Path(), r.LogicalName()), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if data == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Copy content from current to data when needed
|
// Copy content from current to data when needed
|
||||||
if _, ok := current[r.BaseFileName()]; ok {
|
if _, ok := current[r.BaseFileName()]; ok {
|
||||||
data := data.(map[string]interface{})
|
data := data.(map[string]interface{})
|
||||||
|
@ -340,7 +344,8 @@ func readData(f *source.File) (interface{}, error) {
|
||||||
case "toml":
|
case "toml":
|
||||||
return parser.HandleTOMLMetaData(f.Bytes())
|
return parser.HandleTOMLMetaData(f.Bytes())
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("Data not supported for extension '%s'", f.Extension())
|
jww.WARN.Printf("Data not supported for extension '%s'", f.Extension())
|
||||||
|
return nil, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue