-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
globwalk does not work with several relative paths #574
Comments
So it should be fixed upstream then |
At least there, but until then I think it's worth to get mentioned somewhere, that's why I opened this issue here. Others might wonder too. |
Hi, due to Gilnaa/globwalk#28 mentioned above passing a path starting with Could Tera maybe side-step the issue by switching to In my project I'm working around this by taking care to normalize the path I pass to |
If we can make it work without breaking any existing code, sure. |
I am not sure how to guarantee that (I am not sure globwalk and globset behave identically for all inputs). Something simpler to check would be that the change doesn't break any existing test 😅 |
Alternatively we could check if the input starts with This wouldn't really fix the issue, but at least make it more visible why tera doesn't work as expected for this usecase. |
That would still be a breaking change though. |
Only for users that expect that adding a
It should be easy enough to have Tera detect this case and error out, I'll try to propose a PR soon. Too bad there is no clear path to an actual resolution. |
|
I'm perfectly sure those weirdos exist (hyrum's law and all that) 😄 but you don't necessarily have to keep them happy :P |
Yeah it's probably fine if it always returned an empty list of files tbh |
This is because globwalk always returns an empty list in that case, which is likely not what users expect. The corresponding issue in globwalk is Gilnaa/globwalk#28. See Keats#574 for more discussion.
A PR that makes Tera::new error out is up. Locally it produced no test failures. For the record I still think that doing what 99.9% of users would expect out of the box (i.e. treating |
Not sure that I am happy with Tera reporting errors with relative paths like in that PR. It does not fix the problem, it just makes more noise. |
Can we do a PR with a fix as well? |
This is a regression test for Keats#574.
This is to work around an issue in globwalk (Gilnaa/globwalk#28) due to which paths starting with `./` or `../` never match anything. This fixes Keats#574.
This is to work around an issue in globwalk (Gilnaa/globwalk#28) due to which paths starting with `./` or `../` never match anything. This fixes Keats#574.
* Add test for globs starting with "./" This is a regression test for #574. * Always canonicalize glob paths passed to Tera This is to work around an issue in globwalk (Gilnaa/globwalk#28) due to which paths starting with `./` or `../` never match anything. This fixes #574.
While migrating from a NodeJS-based project to a Rust-based project I found Tera as a template-engine, it was ment to be my introduction project to learn Rust.
As I separate my program and the used templates, I wanted to pass a relative path of some upper folder, but Tera did not find them. After some investigation (and local experiments to change
globwalk
withglob
, which did not work due to unsupported syntax having curly-braces"examples/basic/templates/**/*.{html, xml}"
), I found out that it only is an issue for path that point to the current or upper-level folders.Globwalk does not work for paths starting with
./
or../
, there is already an issue open at the other project: Gilnaa/globwalk#28The text was updated successfully, but these errors were encountered: