Skip to content

TemplateSet.FromCache would get error result when use multi loaders #313

@honmaple

Description

@honmaple

I have two loaders, first is NewLocalFileSystemLoader and second is NewFSLoader with embed.FS, when I use FromFile, I could get right result, but FromCache always got error.
From source code https://github.com/flosch/pongo2/blob/master/template_sets.go#L140, I add a debg print

  name = set.resolveFilenameForLoader(loader, tpl, path)
  fd, err = loader.Get(name)
+ fmt.Println(path)

FromFile got abspath and relpath, but FromCache always got abspath, the problem is at https://github.com/flosch/pongo2/blob/master/template_sets.go#L175, why use cleanedFilename with first loader instead of filename?

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions