Skip to content

Commit

Permalink
Fix regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
Exelord committed Mar 22, 2019
1 parent 70d23c0 commit 14027ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/middlewares/json-api-koa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ async function authenticate(app: Application, ctx: Context) {

function urlData(app: Application, ctx: Context) {
const urlRegexp = new RegExp(
`^\/?(?<namespace>${escapeStringRegexp(
`^(\/+)?((?<namespace>${escapeStringRegexp(
app.namespace
)})(\/?(?<resource>[^\/]+))?(\/(?<id>\\S+))?`
)})(\/+|$))?(?<resource>[^\s\/?]+)?(\/+)?(?<id>[^\s\/?]+)?(\/+)?`
);

return (ctx.path.match(urlRegexp) || {})["groups"] || {};
Expand Down

0 comments on commit 14027ed

Please sign in to comment.