Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Faulty logic in param matching for getRouteRegExp #69

Open
joacimastrom opened this issue Oct 25, 2021 · 2 comments
Open

Faulty logic in param matching for getRouteRegExp #69

joacimastrom opened this issue Oct 25, 2021 · 2 comments

Comments

@joacimastrom
Copy link
Contributor

The matching of params when creating the regex is breaking since params extracted from the route will have format [":param1", ":param2"] while the ones added wont have the : since they are likely used as:

getCacheConfRegExp(cacheConf, {
  param1,
  param2,
});

Even if you explicitly name the params

getCacheConfRegExp(cacheConf, {
  ":param1": param1,
  ":param2": param2,
});

the pattern-replace will fail in the loop a few lines down since it then tries to match ::param1 which doesn't exist in the route

pattern = pattern.replace(`:${paramName}`, params[paramName]);
@joacimastrom
Copy link
Contributor Author

Opened a PR with a quick fix for this: #70

Ought to be non-breaking?

@joacimastrom
Copy link
Contributor Author

@patrixr have you had the chance to take a look at this?

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

No branches or pull requests

1 participant