Skip to content

Handle urls ending with / when creating new sites#1081

Merged
gautamdsheth merged 1 commit intopnp:devfrom
jackpoz:fixes/CreateSiteEndingWithSlash
Nov 16, 2024
Merged

Handle urls ending with / when creating new sites#1081
gautamdsheth merged 1 commit intopnp:devfrom
jackpoz:fixes/CreateSiteEndingWithSlash

Conversation

@jackpoz
Copy link
Contributor

@jackpoz jackpoz commented Oct 30, 2024

Handle urls ending with / when creating new sites by removing any empty entry after splitting the url by /.
This is needed when the url ends with / as the last part after Split('/') will just be an empty string, causing Replace("", "") to be called, throwing an exception.

This has been reported at pnp/powershell#4491 and can be reproduced calling New-PnPSite:

 New-PnPSite -Type TeamSiteWithoutMicrosoft365Group -Owner <owner upn> -Url "https://<tenant>.sharepoint.com/sites/TestWithSlash/" -Title "Test With Slash"

image

The PR fixes the issue and the site is created:
image

@gautamdsheth gautamdsheth merged commit 98ff810 into pnp:dev Nov 16, 2024
@gautamdsheth
Copy link
Collaborator

Thanks @jackpoz , merged it !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants