mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
tlp/resources: resources.Get returns nil when given empty string
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
bafb389b38
commit
db945a6ed2
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user