mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05: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{}
|
||||
err := s.loadData([]source.Input{&source.InMemorySource{ByteSource: sources}})
|
||||
if err == nil {
|
||||
t.Fatalf("Should return an error")
|
||||
if err != nil {
|
||||
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)
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
// Copy content from current to data when needed
|
||||
if _, ok := current[r.BaseFileName()]; ok {
|
||||
data := data.(map[string]interface{})
|
||||
|
@ -340,7 +344,8 @@ func readData(f *source.File) (interface{}, error) {
|
|||
case "toml":
|
||||
return parser.HandleTOMLMetaData(f.Bytes())
|
||||
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