pongo2 icon indicating copy to clipboard operation
pongo2 copied to clipboard

TemplateSet.FromCache would get error result when use multi loaders

Open honmaple opened this issue 3 years ago • 0 comments

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?

honmaple avatar Oct 12 '22 15:10 honmaple