summaryrefslogtreecommitdiffstats
path: root/tpl/resources/resources.go
diff options
context:
space:
mode:
authorshifterbit <48891590+shifterbit@users.noreply.github.com>2022-11-15 00:22:38 -0500
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-11-17 18:09:54 +0100
commitdb945a6ed2ab12de04502957151d55779cbdd39d (patch)
tree344fefc21148f2d491bea035dac1b779b6108ac1 /tpl/resources/resources.go
parentbafb389b38b8fe523712583d566cd22003d5672c (diff)
tlp/resources: resources.Get returns nil when given empty string
Diffstat (limited to 'tpl/resources/resources.go')
-rw-r--r--tpl/resources/resources.go5
1 files changed, 5 insertions, 0 deletions
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)
}