tera icon indicating copy to clipboard operation
tera copied to clipboard

Template discovery needs templates folder parent read access

Open ecumene opened this issue 2 years ago • 0 comments

Here's a bug I found when playing with Tera in wasm32-wasi target.

I have this simple setup:

site/
 - templates/
   - base.html

I mount it to the WASM+WASI runtime (wasmtime) from ./site/templates to ./templates, so that the WASI instance only has access to that directory.

This gives me a Template 'base.html' not found error message. When I mount ./site/ to ./, it works just fine. I initialize Tera's template directory to templates/**/*. I'm assuming globwalk begins at ./, and can't do a directory sweep and fails here:

https://github.com/Keats/tera/blob/8ebae36ffde50cef0055584b2110f11b9b672e17/src/tera.rs#L138

I also tried using ./templates/**/* but no dice. Allowing the WASM+WASI module access to ./ doesn't for me because it's too permissive.

ecumene avatar Jul 17 '21 22:07 ecumene