-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{path*} segments disappear when empty #24
Comments
Note that this issue also effects optional params, which are omitted from the output when empty, contrary to what the docs say. |
So this issue has been there since hapijs/hapi#1644, which initially broke the At the time you seem to think that you fixed a bug, though it is not apparent which one. What is apparent is that the documentation still reflects the old behaviour, and that it broke some uses of the directory handler, where the implementation expects the length of the For reference, this is the line in the docs that specifies the old behaviour:
While I wouldn't mind fixing this in |
@hueniverse ping? |
While your patch helps, I suspect your fix will still cause issues with Inert, without the |
Returning an object with keys explicitly set to undefined is a bad API. You can get the number of total params from the route info. |
@hueniverse So this is definitely still an issue for inert when the slash is missing. I wouldn't mind retrieving the total count from the route, however this is not exposed in the Btw. I don't care about |
So either you get the number of path parameters in the config or |
Yes, I will need one of those. If it's |
How do you handle a path like |
Hmm, I think relying on |
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. |
The Inert directory handler behaves incorrectly when a route contains dynamic segments and the incoming
{path*}
part is empty.Eg. the route
/{domain}/{path*}
matches/main/
, but only includes thedomain
part in the output withparams: { domain: 'main' }, paramsArray: [ 'main' ]
.I would expect
params: { domain: 'main', path: '' }, paramsArray: [ 'main', '' ]
.Note that Inert depends on the length of the
paramsArray
to determine the last path segment for the directory handler. See hapijs/inert#74 for some background.The text was updated successfully, but these errors were encountered: