Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regression was introduced in 9479c28. Since that commit providing an invalid glob to tera will make it fail to create an instance, first (in that commit) by making it panic and since 1f95878 by making it return an error. While returning an error is not entirely unlogical, it doesn't match what most languages do with invalid globs. - Bash will by default return an empty set on invalid globs, as the `failglob` option is off by default - Python will likewise return the empty set instead of throwing an exception, when doing something like `glob.glob("/dev/null/*")` - Rust's `globwalk` will also not error, but return an empty set In fact, we use globwalk in tera and the only reason we panic is by accident, because `std::fs::canonicalize()` checks the path. It is better to match other language's glob behaviour, therefore we resort back to the original path if `canonicalize()` fails to return the empty set again when encountering an invalid glob. Even more so, since this caused a lot of regressions already, including in zola. Fixes getzola/zola#2150 ref: Keats#819 ref: Keats#820 ref: Keats#799
- Loading branch information