Skip to content
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

/test is matched when specifying path: '/' #26

Open
mpech opened this issue Sep 11, 2021 · 0 comments
Open

/test is matched when specifying path: '/' #26

mpech opened this issue Sep 11, 2021 · 0 comments

Comments

@mpech
Copy link

mpech commented Sep 11, 2021

Goal:
match '/' for home
and default anything else to a 404Component

However, when speciying my "IComponentRoute":

{
path: '/',
component: whatever,
fuzzy: false
}

the deduced regex by util::router::matchRoute is
^[/]?(\/|$)/
which then matches the path /test

I would expect /test not to be matched.

For now, I am specifying for path '/[^\w]' which seems to be sufficient but that relies too much on implementation
new RegExp(`^[\/]?${routePath}(\/|$)`);
which takes the string as is.
May better directly offer possibility to input regex in this case if we don't handle the '/' as strict match

Maybe I overlooked something though?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant