URI: 
       Fix resource name in resources.ByType - hugo - [fork] hugo port for 9front
  HTML git clone git@git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit a4b17470a81e3c0ac71fd43aef2110336bfe6848
   DIR parent 4d5e173cf82b74c53e3279d75b0243e86ee8bcfc
  HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
       Date:   Thu,  7 Mar 2024 09:00:44 +0100
       
       Fix resource name in resources.ByType
       
       Fixes #12190
       
       Diffstat:
         M hugolib/mount_filters_test.go       |       2 +-
         M resources/resource_factories/creat… |       7 +++++--
         M tpl/resources/resources_integratio… |       2 +-
       
       3 files changed, 7 insertions(+), 4 deletions(-)
       ---
   DIR diff --git a/hugolib/mount_filters_test.go b/hugolib/mount_filters_test.go
       @@ -112,6 +112,6 @@ Template: false
        Resource1: /js/include.js:END
        Resource2: :END
        Resource3: :END
       -Resources: [/js/include.js]
       +Resources: [include.js]
        `)
        }
   DIR diff --git a/resources/resource_factories/create/create.go b/resources/resource_factories/create/create.go
       @@ -128,13 +128,16 @@ func (c *Client) match(name, pattern string, matchFunc func(r resource.Resource)
        
                        handle := func(info hugofs.FileMetaInfo) (bool, error) {
                                meta := info.Meta()
       +
                                r, err := c.rs.NewResource(resources.ResourceSourceDescriptor{
                                        LazyPublish: true,
                                        OpenReadSeekCloser: func() (hugio.ReadSeekCloser, error) {
                                                return meta.Open()
                                        },
       -                                GroupIdentity: meta.PathInfo,
       -                                TargetPath:    meta.PathInfo.Unnormalized().Path(),
       +                                NameNormalized: meta.PathInfo.Name(),
       +                                NameOriginal:   meta.PathInfo.Unnormalized().Name(),
       +                                GroupIdentity:  meta.PathInfo,
       +                                TargetPath:     meta.PathInfo.Unnormalized().Path(),
                                })
                                if err != nil {
                                        return true, err
   DIR diff --git a/tpl/resources/resources_integration_test.go b/tpl/resources/resources_integration_test.go
       @@ -155,6 +155,7 @@ I am a.txt
        -- assets/b.txt --
        I am b.txt
        -- layouts/index.html --
       +Home.
        {{ with resources.ByType "text" }}
          {{ with .Get "a.txt" }}
            {{ .Publish }}
       @@ -167,7 +168,6 @@ I am b.txt
        
                b := hugolib.Test(t, files)
        
       -        b.AssertFileExists("public/index.html", true)
                b.AssertFileExists("public/a.txt", true) // failing test
                b.AssertFileExists("public/b.txt", true) // failing test
        }