From db945a6ed2ab12de04502957151d55779cbdd39d Mon Sep 17 00:00:00 2001 From: shifterbit <48891590+shifterbit@users.noreply.github.com> Date: Tue, 15 Nov 2022 00:22:38 -0500 Subject: tlp/resources: resources.Get returns nil when given empty string --- tpl/resources/resources.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tpl/resources/resources.go') diff --git a/tpl/resources/resources.go b/tpl/resources/resources.go index 428e36c92..d8f06761d 100644 --- a/tpl/resources/resources.go +++ b/tpl/resources/resources.go @@ -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 // and creates a Resource object that can be used for further transformations. func (ns *Namespace) Get(filename any) resource.Resource { + filenamestr, err := cast.ToStringE(filename) + + if filenamestr == "" { + return nil + } if err != nil { panic(err) } -- cgit v1.2.3