Skip to content

URL constructor not spec compliant #49856

Description

@Upsilon-Iridani

Description

When supplying the URL constructor with a second argument, 'base', paths aren't resolved correctly. see https://developer.mozilla.org/en-US/docs/Web/API/URL/URL#base

The error is visible here: https://github.com/facebook/react-native/blob/900b625ee910cde61f9170e752020e974396aaae/packages/react-native/Libraries/Blob/URL.js#L80-L107

Steps to reproduce

console.log(new URL('/absolute/path', 'https://example.com/base-url/').href);
// prints:       https://example.com/base-url/absolute/path
// expected:     https://example.com/absolute/path

React Native Version

0.73

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info

N/A

Stacktrace or Logs

N/A

Reproducer

N/A

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: AttentionIssues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.Needs: Version Info

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions