diff options
Diffstat (limited to 'resource')
-rw-r--r-- | resource/resource.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/resource/resource.go b/resource/resource.go index 9cf9524b8..4a535889d 100644 --- a/resource/resource.go +++ b/resource/resource.go @@ -72,8 +72,15 @@ func (r Resources) ByType(tp string) Resources { func (r Resources) GetByPrefix(prefix string) Resource { prefix = strings.ToLower(prefix) for _, resource := range r { - _, name := filepath.Split(resource.RelPermalink()) + var name string + f, ok := resource.(source.File) + if ok { + name = f.BaseFileName() + } else { + _, name = filepath.Split(resource.RelPermalink()) + } name = strings.ToLower(name) + if strings.HasPrefix(name, prefix) { return resource } |