mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
tlp/resources: resources.Get returns nil when given empty string
This commit is contained in:
parent
bafb389b38
commit
db945a6ed2
1 changed files with 5 additions and 0 deletions
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue