react-router icon indicating copy to clipboard operation
react-router copied to clipboard

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

Open Wardevour opened this issue 1 year ago • 1 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

https://github.com/remix-run/react-router/blob/8aa203c80d84a37de0b58e0e8be8a4f061c2946f/packages/router/history.ts#L701

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

Wardevour avatar Apr 15 '24 10:04 Wardevour

Is this fixable or is there some kind of workaround? Any info would be appreciated

Wardevour avatar May 30 '24 07:05 Wardevour