pnp / sp-dev-fx-property-controls

Reusable SPFx property pane controls - Open source initiative
https://pnp.github.io/sp-dev-fx-property-controls/
MIT License
235 stars 150 forks source link

toRelativeUrl returns proper relative url in case of root site #609

Closed ramonitor closed 5 months ago

ramonitor commented 6 months ago
Q A
Bug fix? [ x]
New feature? [ ]
New sample? [ ]
Related issues? fixes #X, partially #Y, mentioned in #Z

What's in this Pull Request?

On a root site (i.e. https://customer.sharepoint.com) the toRelativeUrl helper now returns / instead of returning a relative url with // appended to the domain (//customer.sharepoint.com). On non-root sites the behaviour remains as-is.

ramonitor commented 6 months ago

Note; this PR also fixes browser hanging issue with the regex replace on absolute URLs without trailing slash.