more flexible 'index' option for directory handler#10
more flexible 'index' option for directory handler#10kanongil merged 4 commits intohapijs:masterfrom yortus:moreFlexibleIndexOption
Conversation
|
This sounds like a nice feature to include. While it won't do much for new deployments, it can simplify migration from other systems. @hueniverse Would it make sense to allow array of index strings as well, similar to other web servers? |
@kanongil I was just being cautious, because I wasn't sure if allowing an arbitrary string could introduce any security holes. |
|
Array would be nice. As for security, the result path should go through the same checks as any other content. |
|
@kanongil Also, no need for the |
|
@kanongil @hueniverse Array support added, with units tests. I also removed regex from validation, so any string, or array of strings, is permitted for the index option. Do other checks need to be added anywhere? |
…Option Conflicts: lib/directory.js test/directory.js
|
+1 for this |
more flexible 'index' option for directory handler
|
@yortus I have published the 2.1.0 package with this as the only feature. Could you create a PR on hapi with the new version and a documentation update? |
|
@kanongil Done, I think. PR for hapi: hapijs/hapi#2354 (updated API.md) PR for hapijs.com: outmoded/hapijs.com#126 (updated tutorial)
|
|
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
This is a simple backwards-compatible extension to the directory handler, allowing the
indexoption to be either aboolean(as before) or astring(new option).This allows the index file to be configured to be something other than
'index.html', without breaking any previous behaviour.There's also Joi validation to ensure nothing unsafe can be used.
EDIT: Added units tests.