-
Notifications
You must be signed in to change notification settings - Fork 25k
Closed
Description
Description
(apologies if this is the wrong repo - is this a Hermes issue?)
the output of new URL().toString() doesn't seem to match Node or Chromium, which leads me to believe the bug is with React Native or whoever is implementing URL.
this bug has caused issues for me, as (say) https://foo.net?bar=baz/ is different from https://foo.net/?bar=baz (the param is baz/, when it should be baz).
Node:
Welcome to Node.js v20.18.2.
Type ".help" for more information.
> const url = 'https://github.com'
undefined
> new URL(url).toString()
'https://github.com/'
> const url2 = 'https://github.com?foo=bar'
undefined
> new URL(url2).toString()
'https://github.com/?foo=bar'
>
versus the same functions run with RN:
(NOBRIDGE) LOG https://github.com/
(NOBRIDGE) LOG https://github.com?foo=bar/
Steps to reproduce
- Run the reproducer linked below
- Look at the sections with URLs
- Notice the misplaced slash at the end of the second example
React Native Version
0.79.1
Affected Platforms
Runtime - Android, Build - Linux
Output of npx @react-native-community/cli info
System:
OS: Linux 6.11 Ubuntu 24.10 24.10 (Oracular Oriole)
CPU: (8) x64 Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz
Memory: 1.55 GB / 7.03 GB
Shell:
version: 5.2.32
path: /bin/bash
Binaries:
Node:
version: 20.18.2
path: ~/.nvm/versions/node/v20.18.2/bin/node
Yarn:
version: 1.22.22
path: ~/.nvm/versions/node/v20.18.2/bin/yarn
npm:
version: 10.8.2
path: ~/.nvm/versions/node/v20.18.2/bin/npm
Watchman:
version: 0.250301-built-on-0319.0-rexo
path: /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels:
- "35"
Build Tools:
- 34.0.0
- 35.0.0
- 35.0.1
System Images:
- android-35 | Google APIs Intel x86_64 Atom
- android-35 | Google Play Intel x86_64 Atom
Android NDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java:
version: 17.0.14
path: /usr/bin/javac
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 18.0.0
wanted: 18.0.0
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.79.0
wanted: 0.79.0
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: false
Stacktrace or Logs
see above
Reproducer
https://github.com/Rexogamer/react-native-url-bug
Screenshots and Videos
No response