sunng87 / handlebars-iron

Handlebars middleware for Iron web framework
MIT License
119 stars 20 forks source link

DirectorySource path handling is unexpected #23

Closed viraptor closed 8 years ago

viraptor commented 8 years ago

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.

viraptor commented 8 years ago

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

sunng87 commented 8 years ago

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

untitaker commented 8 years ago

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: https://github.com/sunng87/handlebars-iron/issues/23#issuecomment-167074369

Sent from my phone. Please excuse my brevity.

sunng87 commented 8 years ago

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

untitaker commented 8 years ago

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: https://github.com/sunng87/handlebars-iron/issues/23#issuecomment-167087578

Sent from my phone. Please excuse my brevity.

sunng87 commented 8 years ago

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: https://github.com/sunng87/handlebars-iron/issues/23#issuecomment-167087578

Sent from my phone. Please excuse my brevity.

— Reply to this email directly or view it on GitHub https://github.com/sunng87/handlebars-iron/issues/23#issuecomment-167093719.

sunng87 commented 8 years ago

@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!

viraptor commented 8 years ago

Merry christmas :)

sunng87 commented 8 years ago

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 https://github.com/sunng87/handlebars-iron/issues/23#issuecomment-167197711.