Skip to content

Commit

Permalink
Merge pull request #2945 from martinlingstuyl/fix-NewPnPSitetemplateF…
Browse files Browse the repository at this point in the history
…romFolder

Fixes issue with filenames in template output of New-PnPSitetemplateFromFolder. Closes #2944
  • Loading branch information
KoenZomers authored Mar 30, 2023
2 parents 2618887 + aadcec2 commit 87d2145
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 87d2145

Please sign in to comment.