remix-run / react-router

Declarative routing for React

Home Page:https://reactrouter.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: React router doesn't handle 'content://' URLs

Wardevour opened this issue · comments

What version of React Router are you using?

6.22.3

Steps to Reproduce

Create a React project with Vite
Install react-router-dom
Implement a HashRouter in main.jsx
Build an HTML file with npm run build (tested with vite-plugin-singlefile to create a single HTML file)
Transfer HTML file to a mobile device
Open the HTML file with Chrome using a file browser app (Files on Android for example)

Expected Behavior

The application should not have any unexpected JavaScript errors and behave the same as when opening the file with a desktop PC

Actual Behavior

return new URL(href, base);

The line above throws an Error because URL's constructor has 'base' set to a URL that begins with 'content://', which doesn't seem to be supported in Chromium based browsers