Keats / tera

A template engine for Rust based on Jinja2/Django
http://keats.github.io/tera/
MIT License
3.43k stars 279 forks source link

loading template files can easily get into an infinite loop #740

Open PAStheLoD opened 2 years ago

PAStheLoD commented 2 years ago

Hello,

Launching a program that has Tera::new("templates/**/*"); from the root directory on Linux causes globwalk to try to walk all available paths to find paths that start with "templates", but quickly gets lost in /proc/ (because it has some unfortunate symlink loops).

It might make sense to emit a warning if the current working directory is /, and/or do a quick and dirty hack of splitting the pattern along slashes (and make sure the first component is not a wildcard), and look for that subdirectory (and if it exists, supply the path of that as base dir to globwalk).

Also I believe this is the root case to be behind bug #719.

Thanks!

Keats commented 2 years ago

I'd take a PR for that!