sunng87 / handlebars-iron

Handlebars middleware for Iron web framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DirectorySource path handling is unexpected

viraptor opened this issue · comments

DirectorySource treats the path argument in a very literal way. Specifically if there's a file "templates/index.hbs", then

DirectorySource::new("templates", ".hbs")

will register template "/index", but

DirectorySource::new("templates/", ".hbs")

will register template "index". I'd expect both to do the same thing (without initial slash), because the path points at the exact same directory.

This is also a regression from the previous API. Found when migrating older code.

Thanks for figuring out this issue. I will look into it later.

I'd recommend abandoning string-based prefix filtering and using Path throughout the whole impl instead.

On 24 December 2015 10:13:27 CET, Ning Sun notifications@github.com wrote:

Thanks for figuring out this issue. I will look into it later.


Reply to this email directly or view it on GitHub:
#23 (comment)

Sent from my phone. Please excuse my brevity.

Until last time I looked into std::path, some key apis like relative_from, prefix were still unstable.

a.relative_from(b) is b.join(a). Not sure what you need prefix for.

I'd like to try this if you give me a few days. I'm currently busy.

On 24 December 2015 11:35:15 CET, Ning Sun notifications@github.com wrote:

Until last time I looked into std::path, some key apis like
relative_from, prefix were still unstable.


Reply to this email directly or view it on GitHub:
#23 (comment)

Sent from my phone. Please excuse my brevity.

Thanks Markus, then I will leave this to you.

I'm getting something with higher priority too.

On 12/24/2015 07:04 PM, Markus Unterwaditzer wrote:

a.relative_from(b) is b.join(a). Not sure what you need prefix for.

I'd like to try this if you give me a few days. I'm currently busy.

On 24 December 2015 11:35:15 CET, Ning Sun notifications@github.com wrote:

Until last time I looked into std::path, some key apis like
relative_from, prefix were still unstable.


Reply to this email directly or view it on GitHub:
#23 (comment)

Sent from my phone. Please excuse my brevity.


Reply to this email directly or view it on GitHub
#23 (comment).

@untitaker, this issue is fixed by @viraptor via #24. I will close this for now. If you were going to refactor the DirectorySource, feel free to reopen it or send a pull request.

Thank you @viraptor @untitaker for tracking this issue and using this module!

Merry christmas :)

Merry Christmas and Happy new Year!

On 12/25/2015 02:01 PM, Stanisław Pitucha wrote:

Merry christmas :)


Reply to this email directly or view it on GitHub
#23 (comment).