tlp/resources: resources.Get returns nil when given empty string

This commit is contained in:
shifterbit 2022-11-15 00:22:38 -05:00 committed by Bjørn Erik Pedersen
parent bafb389b38
commit db945a6ed2

View file

@ -123,7 +123,12 @@ func (ns *Namespace) Copy(s any, r resource.Resource) (resource.Resource, error)
// Get locates the filename given in Hugo's assets filesystem // Get locates the filename given in Hugo's assets filesystem
// and creates a Resource object that can be used for further transformations. // and creates a Resource object that can be used for further transformations.
func (ns *Namespace) Get(filename any) resource.Resource { func (ns *Namespace) Get(filename any) resource.Resource {
filenamestr, err := cast.ToStringE(filename) filenamestr, err := cast.ToStringE(filename)
if filenamestr == "" {
return nil
}
if err != nil { if err != nil {
panic(err) panic(err)
} }