diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e1d7201b..93c8b6803 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,6 +106,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Fixed `New-PnPSite` cmdlet to work with non-commercial cloud environments. - Fixed `Set-PnPSearchSettings` cmdlet not working with vanity domain tenants [#2884](https://github.com/pnp/powershell/pull/2884) - Fixed `Add-PnPFieldFromXml` cmdlet. It will now return the correct typed field if the added field was of type `Taxonomy`. [#2926](https://github.com/pnp/powershell/pull/2926) +- Fixed `New-PnPSitetemplateFromFolder` removing the first character of filenames [#2944](https://github.com/pnp/powershell/pull/2944) ### Contributors - [enthusol] diff --git a/src/Commands/Provisioning/Site/NewSiteTemplateFromFolder.cs b/src/Commands/Provisioning/Site/NewSiteTemplateFromFolder.cs index a359cced9..8ea0d2c85 100644 --- a/src/Commands/Provisioning/Site/NewSiteTemplateFromFolder.cs +++ b/src/Commands/Provisioning/Site/NewSiteTemplateFromFolder.cs @@ -229,7 +229,7 @@ private string GetFiles(XMLPnPSchemaVersion schema, string folder, string ctid) var fileInfo = dirInfo.GetFiles(Match); foreach (var file in fileInfo.Where(f => (f.Attributes & FileAttributes.Hidden) == 0)) { - var unrootedPath = file.FullName.Substring(Folder.Length + 1); + var unrootedPath = file.FullName.Substring(Folder.Length); var targetFolder = Path.Combine(TargetFolder, unrootedPath.LastIndexOf("\\") > -1 ? unrootedPath.Substring(0, unrootedPath.LastIndexOf("\\")) : ""); targetFolder = targetFolder.Replace('\\', '/'); var modelFile = new PnP.Framework.Provisioning.Model.File()