From 1076561d9118ca81221390310ff27de4c31a8e7d Mon Sep 17 00:00:00 2001 From: Giacomo Pozzoni Date: Wed, 30 Oct 2024 22:04:18 +0100 Subject: [PATCH] Handle urls ending with / when creating new sites --- src/lib/PnP.Framework/Sites/SiteCollection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/PnP.Framework/Sites/SiteCollection.cs b/src/lib/PnP.Framework/Sites/SiteCollection.cs index 1f2fc0349..466759b53 100644 --- a/src/lib/PnP.Framework/Sites/SiteCollection.cs +++ b/src/lib/PnP.Framework/Sites/SiteCollection.cs @@ -904,7 +904,7 @@ private static Dictionary GetRequestPayload(SiteCreationInformat if (siteCollectionCreationInformation.Url.IndexOf("/sites/", StringComparison.InvariantCultureIgnoreCase) > -1 || siteCollectionCreationInformation.Url.IndexOf("/teams/", StringComparison.InvariantCultureIgnoreCase) > -1) { // Split the URL by '/' - string[] urlParts = siteCollectionCreationInformation.Url.Split('/'); + string[] urlParts = siteCollectionCreationInformation.Url.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); // Get the last part of the URL after "sites" string lastPart = urlParts[urlParts.Length - 1];