Skip to content

Commit

Permalink
tlp/resources: resources.Get returns nil when given empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
shifterbit authored and bep committed Nov 17, 2022
1 parent bafb389 commit db945a6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tpl/resources/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit db945a6

Please sign in to comment.