New-PnPSite removing full stops/periods from Alias/URL
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 259
- Forks
- 161
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
When creating a new site with full stops in the Alias these are removed. Sites can be created manually through the SharePoint UI with full stops in their URL.
The associated group retains the full stops in its name.
Steps to recreate:
$adminsString = 'Adminn@TenantName.onmicrosoft.com'
$siteName = 'New site with Full Stops.'
$siteAlias = 'GBL.SharePoint.FullStop.Test'
$SiteDescription = 'Site Description'
$newSite = New-PnPSite -Type TeamSite -Title $SiteName -Alias $SiteAlias -Description $SiteDescription -Owners $adminsString
$newSite
https://TenantName.sharepoint.com/sites/GBLSharePointFullStopTest
The following site can be created in the tenant from the SharePoint admin page:
https://TenantName.sharepoint.com/sites/Test.Full.Stops/SitePages/Home.aspx
Source - it appears to be from the PnPFramework\Sites\SiteCollection.cs file (this call or one of the similar ones):
string siteCollectionValidAlias = siteCollectionCreationInformation.Alias;
siteCollectionValidAlias = UrlUtility.RemoveUnallowedCharacters(siteCollectionValidAlias);
siteCollectionValidAlias = UrlUtility.ReplaceAccentedCharactersWithLatin(siteCollectionValidAlias);
Which goes to PnP.Framework\Utilities\UrlUtility.cs
public static string RemoveUnallowedCharacters(string str)
{
const string unallowedCharacters = "[&,!@;:#¤`´~¨='%<>/\\\\\"\\.\\$\\*\\^\\+\\|\\{\\}\\[\\]\\(\\)\\?\\s]";
var regex = new Regex(unallowedCharacters);
return regex.Replace(str, "");
}
Which removes the full stops.
As I'm new to PnP & Github what's the best way to resolve this?
I'm not sure where else RemoveUnallowedCharacters is called from or for what purpose so don't want to just remove the dot replacement from the regex as it might be required elsewhere:
const string unallowedCharacters = "[&,!@;:#¤´~¨='%<>/\\"\$\*\^\+\|\{\}\[\]\(\)\?\s]";`
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in PnPFramework\Sites\SiteCollection.cs and trace its calls to PnP.Framework\Utilities\UrlUtility.cs, especially RemoveUnallowedCharacters. Check other callers before changing the shared character rules. Done means New-PnPSite preserves full stops in the alias/URL while the other disallowed characters continue to be handled correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100