js-proper-url-join icon indicating copy to clipboard operation
js-proper-url-join copied to clipboard

Path's joined wrong if encoding is disabled

Open daniil4udo opened this issue 2 years ago • 1 comments

I am trying to join path for the router (which is using path-to-regexp).

const path = properUrlJoin('some-path', '/:id?/:subnav?/:step?', {
    trailingSlash: true,
    queryOptions: {
        encode: false,
    },
})

expected output should be

/some-path/:id?/:subnav?/:step?/

but it results to

/flow/:id/?/:subnav?/:step? 

daniil4udo avatar Nov 06 '22 11:11 daniil4udo

I guess that’s because ? has a special meaning in the url. It’s being interpreted as a query string.

satazor avatar Nov 06 '22 12:11 satazor