nanostores/router can't and catch url path containing a '.' in the final sub-path

80 Views Asked by At

I am working on a SPA using a Svelte front-end and using the router, nanostores/router package.

In the Routes.svelte file:

{#if !$page.router}
    <Error404 />
{:else if ...

However, if the url final sub-path contains a full-stop '.' e.g. alpha/beta/abc. or alpha/beta/abc.d the 404 page is not displayed. Instead,I get a HTTP 404 error i.e. the router is not intercepting the request.

As a workaround, I tried a regex replace to remove any full-stops if the above pattern is found.

In the same file: window.location.replace(window.location.pathname.replace(/\./g, '')

This works fine on Firefox, however when using Edge or Chrome browser I still get the aforementioned HTTP 404 error.

Can anyone explain this behaviour and if there is a way to deal with '.' in the url.

Thanks

0

There are 0 best solutions below